How To Code An Email Receipt Template With MJML

We are developers, like you. And what we hate above all in coding is to repeat ourselves. So when it comes to writing email templates, we want to provide our users with the best tools to produce content in the most efficient way possible, whether you want to know how to code an e-receipt or just update your welcome emails.

To speed up the development of responsive emails, we’ve already told you about MJML, the open-source email framework we’ve created. If you’re not familiar with it, go check it out right away. You can thank us later.

But even if MJML can help you save quite a lot of time and ease the process, you’ll probably want more. We hear you.

 

A templating language for your transactional emails

Today, flexibility and personalization are a must-have in the email industry. Transactional emails imply more and more complex business logic, and one can often struggle to try to juggle a lot of different templates, when they could just have one personalized email that adapts to several use cases.

Having a separate template for men and another one for women, or creating specific campaigns to recommend different things based on your customer’s previous purchases is not viable. It is in this kind of situations that a templating language comes in handy.

OK, let’s be a bit naive and accept that you could write your own. But to be able to implement a tokenizer and a grammar, you need to have a good knowledge in the field and, at the end of the day, you might just be reinventing the wheel when you could have been focusing on your core business instead…

You could instead use nice libraries such as Handlebars, Jinja or Twig, but then you’ll still need to write or host a dedicated service to handle the templating processing.

Mailjet’s Templating Language

We have the solution. Because at Mailjet we know the value of a fully integrated templating language, we created our own templating language with our Transactional Send API in mind. Our idea: one template to rule them all, just with a single API call.

So, let’s recap: MJML for producing responsive HTML emails without effort, plus a templating language to bring them to life with conditional blocks and variables.

This combo can change your life as a developer. But, enough words, you’ll definitely want some action. So we’ve decided to show you how to create and send awesome transactional emails, step by step.

 

The “How to code” tutorial: what you need to know

We’re rolling out a series of tutorials, all of which will explore a very common use-case, providing numerous examples, code snippets and nice visuals. We’ve even 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 MJML API and Mailjet Transactional Send API, but don’t worry if you’re a newcomer: applying for the MJML API beta and creating a Mailjet account are totally free.

Our “How To Code” series has four parts. Check them out now:

 

How to code a receipt email template: Quick Introduction

From online shoe stores to indie music platforms, any company selling a product online will have to send a receipt. You may think this is a simple task but, actually, there are several elements you’ll need to consider.

Let’s review them briefly, before jumping over to our tutorial, from the more obvious ones to the less:

  1. You will have to loop over the list of items (cart, abandoned cart, recommendations, etc.) and display them.
  2. You need to display the price and may have to do some calculus directly in the email logic (Total, VAT and other taxes). Be careful, as you may use different currencies!
  3. You need to include some basic billing information (billing address, order number, etc.), but you can also provide more personalized information (for instance, you could warn your users that their registered credit card is about to expire).
  4. If there’s shipping, you should display the delivery address.
  5. Your user may have to forward the e-receipt for accounting purposes, so you should ease this workflow.
  6. You can insert marketing content to your receipt, such as a history of previous items or new promotions based on what your user just bought.
  7. If your website supports multiple languages, your emails should too.

Preview of the receipt email template

 

How to code a receipt email template: Over to Github!

Sounds like something you’re already doing? Or are you not sure how to implement some of these elements?

Worry not, we’ll tackle all these needs, and more, in our dedicated Github tutorial for coding email receipt templates with MJML.

On our Github tutorial you’ll find:

  • Detailed explanations.
  • Code samples to implement and adapt.
  • Examples of a receipt email and its different parts.

Ready to see it in action?

Time to jump over to Github.

Github tutorial: How to code a receipt email

 

Mailjet Helps Facilitate Inter-team Collaboration

If you are already a customer or you follow our news, you know that over the past few years we have been taking the use of our tools very seriously, allowing you to better collaborate with your teams.
Now, we have decided to go a step further and offer even more new features:

  • Advanced restrictions
  • Blocked sections
  • Draft mode

More Sophisticated Advanced Restrictions To Share Only What You Choose

Now, you have the possibility of giving access to your account or sub-accounts to other employees. Now, you can go even further in the management of access sharing by selecting advanced restrictions.

Improve exchanges between your teams by giving specific roles to your employees. You can also set who has the right to block sections, manage your gallery or edit your e-mail templates.

In your account, head to My Account > Account Sharing. Here, you can invite new users and set which pages and which of your account features you would like to give them access to.

Let’s take a specific example: you want to invite your designer to create templates on your account, but you don’t want to let her send an email, because you would like to validate each of her creations before they are used.  

Simply select the role “Designer” when you invite her to your account. She can access all the templates but can only save them in ‘Draft’ status. She will also be able to block the formatting of some sections to prevent other employees from modifying them.

EN-Restricted-Access-Menu

If you don’t want to choose one of the predefined roles – Accountant, Developer, Marketer or Designer – you can choose the “Customized” option and individually select the pages or features to which you would like your colleague to have access.

EN-Personalized-Menu

You now know all you need to ensure that your team members only manage actions they are responsible for, according to the roles you yourself will have set.

This feature is available only for Premium subscriptions starting with Cristal. The number of people to which advanced restrictions can be applied is limited based on subscription type.

Block Section Editing

When you edit a template, you can now choose to block one or several of its sections to prevent one of your employees from editing or deleting them. That way, you can better protect the design of your emails and make work easier for your teams. As for your employees, they can focus on tasks that are assigned to them.

  • When you click on a section, blue edges appear:

Locked Sections

  • Click on the lock and a pop-up will appear to let you select the limitations you would like to implement for each section:

EN-menu-Locked-Sections

  • You can choose to:
    • Completely lock the section so that it can no longer be modified or deleted
    • Authorize only changes to text and images so that the formatting of your section can no longer be modified

Users for whom you have not assigned modification rights for the locked sections will be limited when editing a template. If you have completely locked the section, no access will be allowed (as shown in the image below). If you have blocked editing for formatting only, they can update content without having any impact on design.

Section Locked

This feature is only available for Premium subscriptions.

Edit Your Template Safely In Draft Mode

You can now edit your email without needing to publish it. Why is this useful? You can modify your template without worrying about affecting a template which is already in use. While waiting for a template to be validated, you can simply save it as a draft.

EN-Publish_Draft-Templates

Saving a template in draft mode also lets you authorize members of your team to work on it without necessarily granting the right to publish, leaving you as the designated person in charge of publishing the final version.

 

EN-menu-Save-Draft

That way, your marketing templates in draft status won’t be visible in your gallery when you create a new campaign. Additionally, changes made to an automated template won’t be applied to a workflow once it has been published. Lastly, the final ID of a transactional template will not be provided unless you have published it, thus preventing you from affecting an email in production.

You can head right over to your account to implement advanced restrictions and make collaboration easier between your teams.

We hope you like these new features. Feel free to tell us what you think on Twitter.

Manage Your Templates Easily With Mailjet’s Gallery

A few days ago, we came out with quite a few improvements and features. Today, we’re taking a closer look at the ones that involve managing your templates, to help you get the best use out of them. These new features will let you organize yourself better and save precious time.

Template-Gallery

As a reminder, Mailjet gives you free access to more than 50 templates to get inspired, but you can also create your own easily with our intuitive e-mail editor.

Find your templates easily in your Mailjet gallery

Once you’ve created or modified a template, you can save it and find it directly in your gallery. We have improved its interface so you can find the templates that interest you in just a few clicks.

A new scrolling menu to rank your templates

In your gallery, you’ll find a scrolling menu in the top-right corner  that allows you to organize your templates in the order that you like. You can now sort them by alphabetical order, last modified or creation date.

OrderMenu-EN

Advanced search to find the template of your choice

In the top-left corner of your gallery, you now have access to a search field that lets you find one or several templates by searching by name, desired language or applied labels (learn more about labels below).

EN-SearchMenu

Improved management of your templates

If you click on the small nut above your template to the right, you can choose from a variety of options. Since last year, you have been able to export templates to a sub account  or download your template in HTML or MJML in order to make collaboration easier with your teams.

Today, we have added two new options: adding categories and viewing editing history.

Adding categories to your templates

Most of our customers use Mailjet to create newsletters using different themes, and with more than twenty templates, it can be difficult to find your way around.

In order to quickly find the templates you’re interested in using, we have implemented labels. You can now add labels to your templates to easily find them in your gallery using their colour or apply a filter to group them together easily when you are searching for them from the search field.

In your template gallery, above the menu to the right:

  • Click on the Manage labels button

EN-ManageLabels

  • Then on the button Create a label

EN-2-Create-a-Label

  • Give the name of your choice to your label and select a colour, then click on save and your label has been created!

EN-3-NameOfLabel_Color

To add the label to a template:

  • Click on the nut on the template of your choice and then on Assign a label

EN-4-AttributeALabel

  • Select the label of your choice and click Save

EN-5-SelectALabel

  • The label will appear on your template.

EN-6-LabelCreated

This feature is only available for Premium subscriptions.

See publication history for your templates

EN-Preview_History-link

Hover your cursor over the template of your choice and a new “Preview & history” link will appear. Click on it and you’ll land on a template previsualization page where you can find up to the last 5 published versions of your e-mail. That way, if you’re not satisfied with the most recent changes you made to your template or if you want to see what it looked like before you made them, you can easily turn back the clock by selecting a previously published version.

 

History-Dashboard-EN

Now head to your template gallery to test out these new features.

We hope you like these new features. Feel free to tell us what you think on Twitter.

Facilitated Collaboration And Advanced E-mail Template Management, New At Mailjet!

Ho, ho, ho… No, it’s not Christmas yet, but it’s easy to see why you might think so at Mailjet!

Have you been very nice this year? Probably, because today we have six gifts for you that you can unwrap under the tree (the tree being your Mailjet account – play along ;)).

We are proud to announce the arrival of a bunch of improvements and new features. In a few minutes, you will learn about everything you can now benefit from as soon as you next log in.

A more advanced collaboration with Mailjet

In order to prevent the back and forth in the steps leading to template publication, we have implemented features to let you take on the role of each of your team’s members.

  • 🎁 A lock to secure your favorite sections

Locked Sections

Set which employees can edit a template’s sections to protect the content or your design.

This feature is only available for Premium subscriptions.

  • 🎁 Advanced restrictions for better collaboration

EN-Personalized-Menu

 

Improve collaboration between your teams using advanced settings to define who has the right to block sections, manage your gallery or edit your templates.   

This feature is only available for Premium plans, on Crystal and above.

A more advanced template management

To prevent errors and make it easier to fix them, here are two new features that will put your mind at ease.

  • 🎁 Publication history to go back in time

History-Dashboard-EN

Select the template of your choice and see up to five previous versions published, allowing you to go back to a previous version at any moment.  

  • 🎁 Draft status for your templates

EN-menu-Save-Draft

Save changes to your templates without needing to publish them by using Draft mode. That way, you can work on your Marketing, Automated or Transactional email templates without affecting those already in production. Additionally, you can allow some members of your team to continue working on drafts without granting them the right to publish.

Better organization, effortlessly

Since we know that there is nothing greater than immediately finding what you’re looking for, these features let you gain precious time:   

  • 🎁 Advanced search to find things in the bat of an eyelash

EN-SearchMenu

In your gallery, you now have access to a search field that lets you find templates or template categories by simply typing the name, the desired language or the label of your choosing.

OrderMenu-EN

We also added a new scrolling menu to let you organize your templates the way you like. You can now sort them in alphabetical order, or by last modified or creation date.

  • 🎁 Labels to better organize your template gallery

FR-6-LabelCreated

You can now add labels to your templates to easily find them in your gallery using their color or apply a filter to group them together easily when you are searching for them in the search field.

This feature is only available for Premium subscriptions.

So, isn’t it time to go make a hot chocolate, set your computer on your lap(yes, using it as a heating pad is a well-known trick) and unwrap all your gifts?

Stay tuned – in the next few days, we will present these new features in greater detail so that you can get the most out of them.

Come meet us in person at Mailjet ! :)
While you wait, tell us what you think of your gifts on Twitter and who knows, maybe some new gifts will land under the tree before Christmas ;).

The Ultimate Guide To Holiday Emailing

The Ultimate Guide To Holiday Emailing

For the email marketer, the holiday season is here and it’s time for all of us to get ready to make the most of it. And no, it’s not just about dusting off our Christmas jumpers and lighting up the whole neighborhood with our festive decorations. It’s also about putting together amazing campaigns that will help us to embrace the holiday feeling to build our brand and drive sales.

This year, we’ve combined all our Holiday resources in one, to create your one-stop shop to win the battle of the inbox this season. In our Ultimate Guide To Holiday Emailing, you will learn how to create amazing content for your campaigns, you’ll find great design tips from some of our friends in the industry, and get inspiration from great email examples by top brands.

We’ll help you define a Holiday Email Strategy that will win your customers over, with all you need to know, from setting your goals to that last-minute checklist.

 

Contents:

  1. Setting goals for the holiday season
  2. Crafting irresistible email content
  3. Designing beautiful holiday emails
  4. Brands that rocked the holiday inbox
  5. Mailjet’s Holiday email checklist

 

Only want to have a look at one specific part? Click on the links to download our Content, Design and Email Examples extracts.

Download Mailjet’s Ultimate Guide To Holiday Emailing and prepare to learn from great email examples, discover amazing design tips and get your team together to craft engaging content.

We’re sure you’ll love it, so make sure you’re spreading the word and letting people in on our little secret by sharing on Twitter, Facebook and LinkedIn!

 

Send API 3.1 Reaches General Availability

We gave you a sneak peek a couple of months ago, but now we’re finally here. The time has come to say goodbye to our beloved Send API version 3, and unveil our most improved version,  v3.1!

Over the past three years, our Send API has been doing a great job at routing all your transactional emails, and thanks to your valuable feedback, we’re now ready to introduce its latest version, which is here to make your sending experience even better.

Ladies and gentlemen, after months of hard work and many valuable lessons learned from our developers community during its beta, Send API 3.1 is ready to become our official and stable version. Cue applause.

Don’t worry, we’ll continue to support Send API 3.0, but we’re sure you’re going to love v3.1!

 

So, why did we decide it was time for a new version?

Let’s be honest, no matter how much we enjoy finding hacks and workarounds, there’s not a developer out there that wouldn’t prefer a pain-free experience while at work. And yes, we know how painful API calls can get, especially when you combine little to no documentation with erratic behaviors, obscure input, response payloads…

So, to make your life easier and your work more manageable, we decided to focus on providing our users with a seamless Send API onboarding journey. We provide you with a complete documentation made by developers for developers, and meaningful payloads to offer a smooth experience.

And to make this new version even more advanced, with a real focus on performance and scalability, we decided to rebuild it entirely from scratch, moving away from our previous code in Free Pascal and opting for a new tech stack based on Golang, Cassandra and Kafka, to name a few. Sounds good, right?

 

Awesome! Show me the code, please?

The first thing you’ll notice is how much the onboarding user experience has improved in this new version. Want to see it in action? Check them out here:

Sending messages

Whether you’re sending one or more messages, it will be as simple as making a single HTTP call on the /v3.1/send endpoint. Send API will accept a JSON payload with a single Messages array property containing up to 100 messages. Clear and easy, isn’t it?

New detailed error and success payloads

Thanks to the feedback we received from our community, we decided it was time for a drastic improvement on our response payloads. We now perform strict checks on all your input payload, which means you’ll receive synchronous feedback about what went wrong, in order to cut down your debugging time. On our side, this also means a reduced number of malformed emails entering our system. Check out this example of an error payload.

Something worth noting is that these errors are generated for each message independently, and only the sending process of the failing messages will be blocked.

Our success reporting is also more detailed than it used to be. Success payloads provide, for instance, a MessageHref property, a URL that points to the API endpoint on which to retrieve the message metadata. Tracking your emails straight from the sending has never been easier.

Both success and error payloads are now sent together, in the same order followed by the input payload messages, to make checking the fail or pass status of your messages much easier.

URL Tagging

Sending emails fast, at scale is one side of the business, but being able to monitor how much they perform is critical. Our mission is to offer you all the tools you need to be able to achieve this. Thanks to Send API v3.1, you can now provide us with the proper tracking markers and we’ll make sure all the links your emails contain are properly tagged and report back to you.

 

Sandbox mode

Sending emails for development purposes comes with a cost (yeah, they still count towards your plan’s email quota), and you’re never fully protected from delivering undesired emails to your customers. Whether you’re experimenting with the API for the first time or just checking your code, there might be times when you’d like to test an email payload without having to send a real email. To make your life easier as a developer, we’ve incorporated a brand new sandbox mode. In your input payload, set SandboxMode to true. This will tell the Send API to process your messages as if you wanted to send them, without actually sending them, so you can properly test and troubleshoot your message easily!