Special delivery: Postmark transactional email templates
Today, I have the pleasure to share with you a big set of enhancements that weâve been cooking up for Postmark, and we know youâre going to love them.
We know thereâs a lot to delivering beautiful, actionable, emails to every inbox. Here are just a few things that pop up when creating transactional emails:
- Writing copy that is clear and engaging.
- Inlining CSS styles so that content renders correctly in more email clients.
- Iterating on email designs before and after deployment of your software.
- Sending test emails to make sure everything is pixel perfect.
- Making your email âdynamicâ so that it can be sent with details specific to a particular recipient.
Postmark Templates provide the tools you need to address these challenges and will have you creating awesome emails in no time.
Letâs take a peek:

To start using Postmark Templates, navigate into one of your Servers, and then click on âTemplates.â One of our designers, Derek Rushforth, has put together some rock-solid starter templates. These templates donât just look great (including on Mobile!), they also take into account all of the lessons weâve learned from our research on the best practices for transactional email.
Once youâve selected a template, or decided to code your own (try it, itâs fun!), we head into our editing environment.
We start with our Preview feature that will render the content of your HTML and Text bodies using the same process that would occur if you sent an email using this template from our API (applying dynamic values, then inlining styles).

At this point, you may be wondering, how can we show a fully rendered email if you havenât supplied us with the content for each variable in the template? Postmark Templates includes a powerful feature that can suggest a model for all of the values required by the template. (Donât worry if this doesnât make sense yet, keep reading!)
To show this, letâs put the editor in full screen mode, and click âEdit test variablesâ:


Notice how clean the markup is? We take care of inlining the style blocks (collapsed in the screenshot above), so that updating the structure of your HTML doesnât require another manual trip through a CSS inliner!
This just scratches the surface of all the little things weâve done to make authoring email templates fast and easy.
Letâs talk a little more about what you can do once youâve created your first email template.
We know that in most cases the content of your transactional emails is largely the same. âForgot passwordâ emails often vary in the link thatâs included, and the userâs name, but are exactly the same in every other way. We think sending this sort of email should be as simple as:
client.emailWithTemplate(
âjenny@example.comâ,
âbob@example.comâ,
<template-id>,
{
"link" : â<a href="https://example.com/reset?key=secret" target="_blank">https://example.com/reset?key=secret</a>â,
"recipient_name" : âJennyâ
}
);
Hereâs an overview of how this works:

- You POST a request to our REST API, which includes a TemplateModel, TemplateId, recipient, and sender.
- We lookup the Template associated with the submitted TemplateID, combine the Text, HTML, and Subject content of the
Template
with theTemplateModel
submitted through the in the POST request to create the rendered email content. Note: We do CSS Inlining after weâve applied the TemplateModel, which means selectors like â:nth-child()â apply correctly when we merge arrays of values. - We send the rendered email to the recipient specified in the send request.
To work with templates, weâve opened up all of the normal endpoints youâd expect:
- Create Template
- Update Template
- Delete Template
- List Templates
- Get a Single Template
- Validate Template
- Email with Template
We believe in testing and adopting our products, so Nick Canzoneri built above, using only these public endpoints.
If youâre using our official libraries for node.js, PHP, .net, or Ruby, weâve added Template API support in those clients, so youâll be able to adopt the templating features in no time. You should also check out our documentation on these endpoints, and then come back here, because we have more to show you!
Back? Good.
Introducing Mustachio #
Since weâve piqued your interest, youâre probably wondering what the templating language looks like.
Weâve built a very capable, fast, and safe, templating language that has its roots with another template language youâve probably seen: âMustache.â Since our version is a spiritual descendent of Mustache, but maybe a bit more flavorful, we thought weâd call it âMustachio."

"Mustacheâ + âPistachioâ = âMustachioâ, get it?
If youâre not already familiar with Mustache, including dynamic content in your templates is as easy as:
Hello, {{recipient_name}}!
Seriously, youâve got the basics of the templating language. Mustachio is different from âstandardâ Mustache in three ways:
1. 'Eachâ syntax is added, and is recommended for handling arrays of values in your models:
{{#each people}} {{ name }} {{/each}}
2. Complex keys are supported, for example:
{{ this.is.a.valid.key }} and {{ ../this.goes.up.one.level }}
3. Template 'partialsâ and âlambdasâ are not supported.
Of course, you can see more examples of Mustachio syntax, and get more information on why we differ from âstandardâ Mustache in Mustachioâs Wiki Pages. Weâll follow up in a future post about why we built Mustachio.
We think that access to these tools and content are valuable to the entire community. Thatâs why weâre happy to announce that weâre making the following projects Open Source:
- Mustachio: https://github.com/activecampaign/mustachio
- Style Merge: https://github.com/activecampaign/style-merge
- Transactional Email Templates: https://github.com/activecampaign/postmark-templates
We want you to be able to integrate these tools into your email workflow, even if you use an Email Service Provider other than Postmark.
We love templates so much, weâve already switched over to using them to send notifications from our own applications.
We canât wait to see what you do with Postmark Templates, and hope that they make sending transactional email easier than ever.
What are you waiting for? Try out Postmark Templates, and let us know what you think!