Designing The Perfect Transactional Email: Going Above And Beyond With Templating

by Arnaud Breton December 3, 2015
December 3, 2015

We all agree that email is an amazing channel to engage with our users (if not, start reading this). It’s a space where people get work done, communicate with their personal network and let brands in as well. On top of that, transactional emails drive four to eight times more opens and clicks than marketing email. Transactional email are automated messages that are sent to a user after they’ve taken a predefined action, often to complete or summarize an operation. This includes password resets, shipping confirmation and receipt. Consumers are more likely to engage with this content because it’s information they’re expecting.

In addition to it being important to timely land in the customer’s inbox, we also know that they’re looking for highly personalized content that’ll make the information feel more relevant, valuable and even more credible at times. Imagine receiving a bank statement with “Hello customer”. Now imagine one that starts with a personalized “Hello {{first_name}}”. You probably feel like the latter is more credible right?

Making email more personal is already a big improvement versus generic email. Yet, we can do way better and go way beyond that.

Today, to make this easier for our users, we’re proud to announce that our Send API for Transactional will support templating markup. Leveraging a syntax inspired by the most popular templating languages, like Jinja2 or Twig, so it’s familiar to you already, it allows our users to delegate all the processing of the messages so that you can just focus all your energy on designing great templates that your own contacts will love.

For something with such great value add, it can be frustrating (especially for us developers) how challenging and time consuming it is to build the system pieces needed to achieve that, while not being a core value of your business activity.

Let’s dive deeper into it – starting with a simple example. Since the release of episode VII of Star Wars is happening very soon, let’s use it to contextualize the following example.

We would like to send a different email layout to the good side of the email force, and another one, to the dark side. We store in our backend the side of the force a given contact is on. Knowing that, we can define the following HTML, including Mailjet Template Language conditions on the contact status:

We can also add conditions on the email subject:

This example is quite short and intentionally limited, yet it features the value of adding templating logic in email. Without such a feature, you would have had to define two templates, one for the Jedis and another one for the email dark side. Twice the maintenance effort, many repetitions: it would not have scaled nicely.

Obviously, there are many more – and useful – things to achieve with it, such as including or removing entire sections of the email depending on your contact’s profile, easily including a list of items (loop structure) and many other things we can’t wait to see you implementing from your side.

The Mailjet Template Language for transactional is fully integrated with our Transactional Send API, meaning it accepts both a template or an HTML/Text part containing some templating markup.

Putting everything together, this email can be sent by issuing the following API call with curl:

All this put together would result in an email with the subject “Hello email Jedi!” and with a text/HTML body “Dear Jedi, welcome to Mailjet! May with you, the delivery force be” for (because obviously, Mailjet Passenger is an email Jedi!) and another one with subject “Do you have a dark side?” and text/HTML body “Powerful you have become, the dark side I sense in you.” for let’s say

As always, the same flow can be achieved via SMTP via two new SMTP custom headers we’ll introduce.

The Mailjet Crew has been geeking over this templating feature for quite some time now and we’re super excited that we’re finally able to share it with you. We hope you’re just as pumped as us about the first step of our transactional toolkit. The feature is now available in private beta from today onwards. Reach out to us at to be granted access. Don’t worry if you don’t get around to beta testing though, we’ll be releasing it to the public by the end of the year.

Stay tuned – more exciting product releases (like this one) are coming soon!

Digital & Social Articles on Business 2 Community


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.