Grégory Betton

//

Times flies! This is the last week of our new series of tutorial: for a month, we have shared with you how to create transactional emails templates step by step, using MJML, the open-source email framework with 5100+ ⭐ on Github, and Mailjet’s templating language.

To finish with a bang, we’ll end this series showing you how to implement an efficient personalized digest email.

Sending a digest email, a quick introduction

A personalized digest email is a summary sent on a regular basis (daily or weekly, for instance). These emails convey information in a “digestible” way, mimicking paper publications such as the old popular Reader’s Digest. This format is fast and convenient to read and, therefore, very well received by users.

What will you need to code a personalized digest email template?

Digest emails come in handy when you want to engage your users. In fact, their high frequency, the value they convey and the personalized touch are great advantages that tend to drive higher engagement. In this tutorial, we’ll mainly look at the three following points:

  1. How to loop over your data using our templating language’s “for” loops.
  2. How to personalize your email using variables.
  3. How to determine the frequency with which your reader opens your emails, using templating language built-in functions.

Here’s a quick preview of what it could look like:

email template example

A loop to display them all

A digest usually contains four kinds of data: a title, an image, a short description of the article and a link to the article. Sending a digest with only one article is very uncommon, so you’ll have to deal with an array of data. The best way to iterate over it and access every item’s object is to use templating language “for” loops.

Personalized email all the things

Put yourself in your reader’s shoes for a minute.Do you feel your digest has been built expressly for you? Of course, it is composed of a curated list created by your backend algorithms, but is it enough to feel it’s dedicated to you only? When you send an email with Mailjet, you can use contact properties to tailor the message to the right reader, using the data you added for each contact. Combine them with templating language variables and you’ll be able to display your user’s data to make they experience really unique.

What, is it Monday already?

The frequency of an email digest template is key. You will have some everyday readers, and some who only open your digest once every few months. With our predefined templating language functions, you will be able to adjust your template based on the frequency of open and click events.

We bet you can’t wait to see it in action. So let’s jump over our step-by-step tutorial on Github.


We’ve also created an easy-to-execute tool, written with NodeJS, to test emails under actual conditions. To use it, you’ll just need valid credentials for both the MJML API and Mailjet’s Transactional Send API. Don’t worry if you’re a newcomer: applying to the MJML API beta and creating a Mailjet account are totally free.

Loved this one but have missed our previous tutorials? You should definitively have a look at those too, they are pretty cool:
How to create an e-commerce receipt email
How to send a welcome series email
How to deliver abandoned cart email

Do you want to be the first to know about our next tutorials? Subscribe to our dev-only newsletter now. And if you want to chat with us, come and say “hi” on Twitter.