Back to main menu

Product

Designing the perfect transactional email with templating

We're excited to announce our Send API for Transactional feature - now you can more easily personalize and delegate the processing of transactional email.

Hermes is about to fall from an envelope in front of a Goddess standing on some stairs

PUBLISHED ON

PUBLISHED ON

We all agree that email's an amazing channel to engage with our users on (if you don't, start by 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 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 over generic email. Yet, we can go above and 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. With all the hype about Star Wars VII coming out soon, let’s use it to contextualize the following example.

Say we'd like to send two different email layouts, one to the good side of the email force, and another to the dark side. In the 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 to the email subject:

This example is quite short (and intentionally limited), but it still 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. It's twice the maintenance effort, with many repetitions: it wouldn't 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 passenger@mailjet.com (because obviously, the 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 darkvador@mailjet.com.

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 api@mailjet.com 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!

hAPI Templating with Mailjet!

Popular posts

Hermes rides a firework next to a Goddess in front of a night sky with more fireworks

Email best practices

6 min

Top email marketing trends for 2022

Read More

Hermes on a moped delivering mail to a mailbox

Email best practices

8 min

Reducing email’s carbon footprint

Read More

Mother's day gift for Hera

Marketing

15 min

Marketing calendar 2025: Dates you shouldn’t miss this year

Read More

It's never been easier to build connected experiences. Start sending with Mailjet today.Get started on your path
CTA icon