What Is DMARC and How Does It Work

You are the owner of your own domain. It represents your brand in the best way possible: it is already known by your customers and they are expecting your emails.

But what if one day someone sends an email from your domain offering the same content that you offer to your customers and just pocket the money? Doesn’t sound good. To top it all off, it’s hard to convince people that it wasn’t you…

So keep reading about the amazing powers of DMARC and find out how to avoid such uncomfortable situations.

What is DMARC?

Domain-based Message Authentication Reporting and Conformance (DMARC) is an email validation system created to protect your domain from being used for email spoofing, phishing scams and other cybercrimes.

Think of it like your own personal security guard for your domain. DMARC was created by PayPal with help from Google, Microsoft and Yahoo! as an email security protocol. These industry leaders came together to develop an operational specification, with the desire that it would be able to achieve formal standards status. At this point DMARC is a necessity for the online security of one domain.


When you as a domain owner set up a DMARC record into your DNS record, you will gain insight into who is sending emails on behalf of your domain. DMARC uses the email authentication techniques SPF (Sender Policy Framework) and DKIM (Domain Keys Identified Mail) and adds an important function – reporting.

This means no one will be able to borrow your domain to send an email asking for a $100 donation for the Amazon rainforest and then use the money to buy a new yacht… to go see the Amazon rainforest.

How does DMARC work?

As we mentioned, DMARC relies on the established SPF and DKIM records for email authentication. But unlike SPF and DKIM, a DMARC record could tell the server if he should or shouldn’t accept a message. With DMARC, it becomes possible to gain insight into phishing attacks. This way, customers can be informed in advance and will be aware of attacks.

Every major ISP server performs a DMARC check nowadays and the implementation of DMARC happens more and more frequently. Now let’s take a look at how the record works and understand why we need it.

The process of DMARC validation works as follows:

  1. The domain owner sets the policy, choosing its email authentication practices and how the recipient servers should handle mail that violates this policy. This DMARC policy become part of the DNS records of this domain.
  2. In case that the inbound mail server receives an incoming email, it uses DNS to check the DMARC policy for the sender domain in the “From” (RFC 5322) header. The inbound server then evaluates the message based on three key factors:
    • Is the DKIM signature correct?
    • Is the sender IP included in the SPF record?
    • Do the headers in the message show proper “domain alignment”?
  3. When the information is collected, the server can decide what to do with the message according to the DMARC policy.
  4. The server will inform the domain owner for the outcome and what has happened with the message.

To put it another way, DMARC allows you to secure your domains and decide what should happen when recipient servers receive unauthenticated mail coming from your domain. DMARC is a very powerful solution to fully secure your email domain when configured correctly.

DMARC explained

To understand DMARC even better, we will explain what each part of it means. It might look like strange symbols that don’t have any meaning and the only thing you will understand is your domain, but that’s why we are here to help you.

Once you are done reading this article you will “speak” fluent DMARC language. Let’s start with how a DMARC looks, and then go through it piece by piece:



v=DMARC1 is the identifier that the receiving server looks for when it is scanning the DNS record for the domain it received the message from. If the domain does not have a txt record that begins with v=DMARC1, the receiving server will not run a DMARC check.


“p=none” tells the receiving server what to do with messages that fail DMARC. There are three policy options – none, quarantine and reject. What policy is best for you depends on your needs.

Let’s dig a bit deeper into them, because we dare to say that this is the most important part of the record.

Monitor policy: p=none

The DMARC policy “none” tells the email receivers to send DMARC reports to the address published in the “rua” or “ruf” tags of the record. It is known only as a monitoring policy because with it you gain insight in your email channel. But, it does not instruct email receivers how to handle emails that fail the DMARC checks. You can use the “none” policy to start with DMARC and gather all DMARC reports and start analyzing this data.

Quarantine policy: p=quarantine

Another type of policy is the “quarantine” one. This DMARC policy instructs email receivers to put emails that fail the DMARC checks in the spam folder and also sends the DMARC report. The quarantine policy already controls the impact of spoofing, but spoof emails will still be delivered to the receiver (but in the spam folder… and who is checking that, right?).

Reject policy: p=reject

The third policy is the “reject” one. Besides sending DMARC reports, the DMARC policy completely rejects the emails that fail the DMARC checks. All other emails that pass the DMARC checks will be delivered in the primary inbox of the receiver. This policy best mitigates the impact of spoofing.



This tells the server where to send aggregate reports of DMARC failures. We’ll see more about the reports in the next section of the article. You can add any email address you choose or even add multiple ones.


This is for the forensic reports of DMARC failures. With this, there is one requirement for the email address – it must be from the domain that the DMARC record is published for.


Once we chose the email address where we want the reports sent, we should choose what kind of reporting we want. In this case rf=afrf means aggregate failure reporting format. This would be perfect for you, if you have a system already set in place that monitors those reports.


This part of the record tells the server how much of their mail should be subjected to the DMARC policy’s specifications. In this case, if the p= (remember the three policies up above?) was set to reject, 100% of the mail that fails DMARC would be rejected.

Other key mechanisms:

There are a number of other mechanisms that can be included in a DMARC record. A few important ones are:


This part would tell the receiving server whether or not to apply the DMARC policy to sub domains. The values are the same as “p=”.


This sets the DKIM alignment. It can either be set to “s” for strict or “r” for relaxed. Strict means the DKIM portion of DMARC authentication will only pass if the d= field in the DKIM signature exactly matches the from domain. If it is set to relaxed, messages will pass the DKIM portion of the DMARC authentication if the DKIM d= field matches the root domain of the from address.


Indicates strict or relaxed SPF identifier alignment. The default is relaxed.


This sets the interval for how often you want to receive aggregate reports about DMARC failures. The default value is 86400 seconds which is equivalent to one day.

Let’s stop here before it gets too overwhelming and see know what a DMARC report shows and how it helps your brand to avoid any spoofing.

DMARC reports

As we saw in the previous section, the reports can be two different types: aggregated and forensics. Those reports help you ensure you that you are properly authenticating your outbound emails. You can check out the difference between both of them below.

Aggregate reports

They are XML documents showing data about the messages received that claimed to be from a particular domain. Those reports are meant to be machine-readable. Here’s one example:

Forensic reports

These are individual copies of messages which failed authentication, each enclosed in a full email message using a special format called AFRF. Those reports are easily read by a person, too. The information that those reports could contain is:

  • Subject line
  • Time when the message was received
  • IP information
  • Authentication results
    • SPF result
    • DKIM result
    • DMARC result
  • From domain information
    • From address
    • Mail from address
    • DKIM from address
  • Message ID
  • URLs
  • Delivery result
  • What was the applied policy, the message could be rejected if there’s a reject policy in place, or quarantined, or delivered because of a none policy
  • ISP information

Now we know how a DMARC works, how it looks, and what information it provides. We’re pretty certain you already know how useful this could be for you. But let’s see all advantages in the next section.

Do I need DMARC?

If you are a business sending any emails that include personal information (invoices, order confirmations, even account activation ones), or any emails with marketing purposes (commercial), you definitely need to implement one or more forms of email authentication to verify that an email is actually from you and your domain.
DMARC helps receiving servers determine how to evaluate messages that claim to be from your domain, and it is one of the most important steps you can take to improve your deliverability. Even if DMARC is not obligatory for sending with Mailjet, we recommend you set it up so you can avoid any spoofing alongside with the SPF and DKIM. Check the links to learn how to set up SPF and DKIM.

We know that this article is enough to understand how to set up DKIM, but you can always check the guide of our colleagues/partners from Google by clicking here. For any general questions about DMARC you can always contact our support.


Let’s wrap it up

With DMARC, an organization can block malware, phishing attacks, and improve its deliverability all at the same time. Once enabled, a DMARC record ensures that only authorized senders are able to use your domain to send messages. That means recipients can tell at a glance who the email really comes from, and they can be certain that it’s not coming from a spoofed domain.

DMARC will make sure that emails that use your domain but fail authentication won’t even appear in recipients’ inboxes. So no one will be able to collect money to go to the Amazon rainforest by using you brand.

Don’t wait! Set up your DMARC and be sure that no one is using your domain without you knowing.

For more useful tips don’t forget to follow us on Twitter and Facebook.

This is an updated version of the blog post “Some words about DMARC” published on the Mailjet blog on April 25, 2014.

Mailjet SMS is Now on Zapier

Yes, you heard us right. With Zapier’s help, you can now easily integrate Mailjet’s SMS.

If you already tried the transactional SMS option of Mailjet, you know how easy it is to use. Now, it’s a piece of cake to send SMS to your customers for two factor authentication, order confirmations, booking numbers and any other transactional purpose you can think of.

What is Zapier?

Let me throw a scenario at you. Say you wanted to create a new line in a spreadsheet every time someone contacts you through your website with the information of their request. You’re thinking you’ll have to download the information manually, copy it and then paste it… Every. Single. Time.

We feel your pain, but worry not, Zapier will make this a whole lot easier for you.


Simply put, Zapier is a tool that connects and automates most of the apps you use, like Mailjet, WordPress, Gmail, Zoho, Trello, and hundreds more. And the best thing? You don’t need any coding to do this! If you’ve ever used IFTTT (If This Then That), it’s very similar, but Zapier lets you string multiple actions together to build multi-step zap workflows. Think of it like, “if this, then that and that and that and that.”

You can have Zapier automatically repeat tasks you would normally do yourself in your different apps. You can create a “Zap” that connects two or more apps so they can talk to each other without you even entering the conversation. It allows you to connect apps that don’t normally communicate AND automate tasks between them.

Let’s say that you have one employee who only speaks English (let’s call him Mailjet) and another who only speaks French (we’ll call him BigCommerce). Normally, Mailjet and BigCommerce wouldn’t be able to speak to each other because those two languages are so different. But because Zapier speaks API, it will act as the translator between them and make the communication possible.

And what is API you might ask? API is the universal language of all programs, and with its help, Mailjet and BigCommerce can talk to each other.

Within a Zap, there are Triggers and Actions. If a Zap functions on a cause and effect model, the cause would be your trigger, and the effect is the action. Here’s an example: imagine you have a new order in Shopify. This would be the cause (trigger) for the effect (action) of sending an email with the tracking details using Mailjet. Automated data flow –it’s a beautiful thing, right? 🙌

Mailjet’s transactional SMS

The average open rate for transactional SMS is 98%, making it one of the more powerful ways to reach your contacts. With Mailjet, you can now easily create and send personalized transactional SMS messages to your customers in more than 60 countries. I’m sure you can see why we introduced our SMS solution 😎.

Everytime we are creating an API feature, we are sure to take two things into consideration for our users: how useful is it, and how easy is it to implement.

We already said why this is useful, and exactly how useful it is (98% open rate!). We are also happy to tell you that it is pretty easy to use our SMS API, allowing you to send SMS messages all around the world with only a few lines of code!

Right now, we only support transactional SMS, such as booking confirmation, subscribing or making a purchase. Just like transactional emails, transactional SMS messages are triggered by an action on behalf of the customer. For example, if you are running a travel agency, you can easily send booking confirmations per SMS too.


To send SMS messages with Mailjet, you need two things – funds in your SMS wallet and a Bearer token to authenticate your requests.


To find out how to do this, check out our guide for SMS.

Mailjet & Zapier

At this point, you may be wondering how Mailjet and Zapier fit together. We’ve got that question covered.

The Mailjet x Zapier integration allows Mailjet clients to extend the reach of their Mailjet account to their favorite apps. You can start transferring data back and forth between your Mailjet account to various third party SaaS applications. With our integration, you can easily send emails and SMS through Zapier. Let’s start with the SMS option.

Sending SMS

With the new “Send SMS” Action in Zapier you can easily integrate Mailjet’s SMS API. Connect your platform (e-commerce, CRM, or other) to Mailjet and automatically send transactional SMS messages when an event occurs.

When someone buys something from your online store, you can send them the order confirmation and the tracking number via SMS, so they can easily check it on their phones any time they need. Ingenious, right?

And the cherry on top: the set up is really easy! You can see how to create and manage your SMS Zaps in our detailed guide.


Sending email

But what about when it comes to sending for marketing purposes? Well, then you will still have to send an email. With our amazing responsive email builder Passport, you can create beautiful emails with very little hassle on your part.

You can take advantage of the services that Mailjet offers, such as Real-Time Monitoring, Template Language, Dedicated IPs and others. Then, you can automate your tasks using our Zaper integration. Send them a welcome email, or maybe shoot off some emails for new offers that could interest your clients, then track open and click data. You can analyze the data with more than 1,500 tools that will make your work so much easier for you.

Summing up

SMS is the perfect option to address your customers with information about their orders, and it can even be combined perfectly with your marketing emails. Mailjet gives you access to features that can help you improve your deliverability, boosting your customer engagement. Your customers will love to have their order information in front of their eyes as soon as they click purchase

Zapier can also help you easily integrate with your own tools and applications. Check out the Mailjet integrations you can use through Zapier here.

So what are you waiting for? Start exploring and share your thoughts with us on Twitter!

Contact Form 7 Is Now Available on Mailjet’s WordPress Plugin

Do you use WordPress? If so, we’ve got news. Big news. The best news.

Mailjet’s integration with WordPress is now even better. “How’s that possible?” you ask… Well, we’ve just added WordPress’ most popular plugin, Contact Form 7, to our own integration with WordPress! Want to know how you can use it and how to make contact list growing and email sending easier? Read on!

Why you should use WordPress

If you’re not using WordPress yet, but are curious as to why so many others do, here’s a small introduction.

WordPress is an online, open source website creation tool. Many famous blogs, news outlets, music sites and celebrities use WordPress to create and manage their own sites. If you’re wondering what makes WordPress special, here are the four most important reasons for us.

WordPress is free

Yes, that’s right! WordPress is a free software. This means you are free to download, install, use, and modify it to match your needs.

However, while the WordPress software itself is free, you need a domain name and web hosting to install it… and unfortunately those aren’t free.

WordPress is easy to use

WordPress is not only for web designers or programmers. As a matter of fact, most people using WordPress don’t have any prior experience in creating websites.

For non-tech savvy folks, WordPress is the perfect solution because there are thousands of free website templates (themes) that you can choose from that will make designing your e-commerce page, news site or photography portfolio much easier.

WordPress is SEO friendly

Have you noticed that WordPress sites tend to rank higher than others in search engines?

This is because WordPress is written using standard compliance high-quality code and produces semantic markup. Translated into human language, this means that Google and other search engines love WordPress. To make it even better, you can use a number of SEO plugins for WordPress like Yoast, SEMrush, SeoQuake and others.

WordPress offers many plugins

Speaking of plugins, WordPress offers a lot! Just like themes, there are thousands of free and paid plugins available for you to use. For example, there are plugins that will allow you to create contact forms, increase your site’s security, manage users, improve the performance of your page and loads more.

And because plugins are what this article is all about, let’s dive deeper into two of them: the Mailjet and the Contact Form 7 plugin.

Integrating Mailjet with WordPress

Simple to install and set up, the free Mailjet for WordPress plugin will help you create, send and track beautiful newsletters in minutes. Mailjet is an all-in-one solution to send, track and deliver both marketing and transactional emails, which means can leverage all of Mailjet’s options through WordPress once you have installed our plugin.

Here are a few of the things you can do with the Mailjet x WordPress plugin:

  • Create amazing emails using our drag & drop email editor, Passport, directly from WordPress.
  • Send your emails to your contact list without leaving WordPress.
  • Sync your contacts and contact properties with your Mailjet account, so you can personalize the content of your emails.
  • Check your statistics from your WordPress.


Setting up the Mailjet x WordPress plugin

Can’t wait to try it? The latest Mailjet for WordPress v5.1 can be downloaded from the WordPress plugins directory.


Setting it up is also really easy.

To configure the Mailjet plugin, first click on ‘Setup account’ from the Installed Plugins page.


You will then be asked to enter your Mailjet API and Secret key here.


Once that’s done, your Mailjet account will be connected to your WordPress and ready to use. See? We told you it was easy!

What is Contact Form 7

Contact Form 7 is a plugin that allows you to create, customize and integrate any kind of contact forms on your WordPress site. If you have a WordPress website, a contact form is a valuable addition to it. Instead of asking your readers to contact you via mail, you can provide a contact form page and ask your users to give feedback or send queries via the form.

Contact Form 7 is the most popular free WordPress plugin. It’s easy to use and supports multiple contact forms, AJAX submitting, file uploading, and CAPTCHA. Contact Form 7 has more than 5 million users – impressive, right?

The Contact Form 7 plugin’s most significant feature is that it is really simple and easy to use. Some other features that make it a winner are:

  • Complete customizability using simple mark-up
  • Simple interface and several options
  • Useful and detailed documentation
  • Submissions in the Contact Form 7 come directly to your mailbox


The Contact Form 7 plugin can be found in the same plugin directory in which we found the Mailjet one. Just search for it, install it, and activate it.


To create a Contact Form, click on Contact > Contact Forms from the admin dashboard. There is a listing of the forms available which will be blank right now before you add one. Click on Add New and choose the language you need.

Then you will see the new contact form editor. The fields required for any contact form are already present in the form – Name, Email, Subject, Message and Submit button. There is a simple mark-up format to be followed, so you won’t miss any of those fields.

You can add more fields if needed, make them obligatory, or add reCAPTCHA. When you are done with your form click on the save button.

Adding Contact Form 7 to the Mailjet plugin

Great news! Because we know how useful Contact Form 7 is, we’ve now added a new integration with Contact Form 7 as part of the Mailjet plugin for WordPress. Now you can easily add a “Subscribe to our newsletter” checkbox to your Contact Form 7 forms. It will let you automatically add form submitters to a contact list in your Mailjet account.

As Mailjet is the first ESP to get GDPR certified, it is really important to us that all subscriptions be confirmed using double opt-in. So each visitor that checked the subscription box will receive a confirmation email.

To use the integration, simply enable it in the Mailjet plugin Settings → Integrations tab. Configuring the integration is as easy as 1-2-3.

  • Choose the list where form submitters will be added.
  • Make sure the email field tag and the name field tag (optional) match the tags in your Contact Form 7 form
  • Copy the Mailjet checkbox code and paste it in your Contact Form 7 form. Once you have this code, you should go back to your contact form that you already created. Paste it inside the form and the integration is complete!

Now it is easy to win subscribers when someone goes to your contact form to send you a message or request a quote. What could be better? That’s right – nothing. So, don’t wait – integrate Mailjet and Contact Form 7 with your WordPress page and make your site event better and your sending easier.

You can refer to our step by step guide for further instructions.

Summing Up

We saw how cool WordPress is and how the integration with Mailjet can make your sending easier. Create your site with WordPress and manage your contacts and sending with Mailjet. Now there is no need to leave your WordPress to send, track and manage emails and you can automate the synchronization of contacts with only a few clicks.

And what could be better than to be able to win customers when they are trying to contact you? This is why we introduced Contact Form 7 in our WordPress plugin, so you can add “Subscribe to our newsletter” at the bottom of any of your contact forms.

Grow your business faster than ever. Hurry up and download the plugin that can make your life easier. Discover all the amazing Mailjet features you can use directly through WordPress or our site.

You can find all of Mailjet’s integrations here and we promise there is a lot to discover. 😉

For more tips and new information, don’t forget to follow us on Twitter and Facebook.

What Is a Webhook and Why Do You Need It

Wondering what is a webhook and how it works?

Well, just think about the amount of information you get about the emails you send. We’re sure you love all the detailed stats Mailjet offers, but you wish there was just a way the right ones would come to you, so you wouldn’t need to you looking out for them. Well, luckily, there actually is. Today, we’ll tell you all about webhooks, how to set them up and how to use them to drive your email program.

What is a webhook?

Imagine that you have an online store and you want to offer a special discount for anyone opening your email in the first 24 hours. You can do it manually, by checking your email stats regularly and manually sending those who opened the discount code. But that would take you a lot of time, right?

Or you can do it automatically with webhooks, which will trigger a message with the additional discount to anyone that opens your email. Sounds more efficient, right?

Simply said, webhooks are events that trigger an action. In most cases, they are used for communication between systems. This is the simplest way of getting an alert when something happens in another system. They are called webhooks because they work as software hooks over the web.

How do webhooks work?

Let’s take your bank as an example. When you make a withdrawal using an ATM, the machine checks your balance and gives you the amount you requested. Once this operation is done, your balance is updated and this change triggers an action – an SMS is sent with the details of the withdrawal.

That’s how webhooks work. An action serves as a trigger for another action. The rest is a popular architecture used to communicate between systems.

A webhook is a HTTP callback: a HTTP POST that occurs when something happen – an event-notification via HTTP POST. Webhooks are used for real time notifications, so your system can be updated right when the event takes place.

Most commonly, webhooks are HTTP callback points that are defined by the user. They allow you to register an http:// or https:// URL where the event data can be stored in JSON or XMLformats. After that, you will be able to do what you want with the data you retrieve and store from a certain event.


The core mechanics of webhooks consist on making an HTTP request to a user’s specified URL. A webhook makes an HTTP callback to a URL that has to be configured by the system which receives the data.

That URL is called webhook endpoint. Webhook endpoints need to be public and it’s important that this URL belongs to the receiving system. The callback is triggered whenever there is an event you’d like to notify another system about.

For Mailjet, this webhook is a URL you can add in our system, so you can receive email events, such as “sent” “open, “clicked”, “bounce”, “block”, “spam” or “unsubscribe”. This way, you can either track your messages the whole path, of your message or just “listen” for the status you want.

Let’s go back to the ATM example. When you make the withdrawal, your bank is notified and updates your balance, which is the indication for the system to send you an SMS with all the details.

Webhooks work on the same concept. The ATM is a third-party app/site (webhook provider) that sends a signal when a specified event occurs. The system that sends you the SMS is what is known as the “listener”. The listener is the URL that receives the webhooks calls and performs a predefined action after that – in this case, sending the SMS. Webhooks are a programming mechanism designed to receive data that originates in some external system, in real time. In this case, that system is the bank account. Is it clearer now?

But what sort of things can you do with webhooks? Among other things, you can:

  • Synchronize systems in real time;
  • Send any kind of notification;
  • Process the data however you want;
  • Create reports;
  • And almost anything else you can think about!


Why do we need webhooks?

There are two ways your apps can communicate with each other to share information: polling and webhooks. In our example with the bank, polling would be going to your bank and asking what your balance is each time you make a withdrawal.

Nowadays, everyone needs a simpler way to get data out in real time, so they can easily do whatever they want with it. That means, no polling every minute for large exports that your system would then need to parse, risking a system overload or losing the data if there’s a bug. Using HTTP is a simpler and easier solution, as webhooks are automated messages sent from apps when something happens.

polling_vs_webhookSource: Cloud Elements – check out their post to learn more about the difference between polling and using webhooks.

There are two ways you can use webhooks:

  1. To receive the event information and store it;
  2. To receive the event information and pass it on;

Let’s look into these two scenarios closer.

To receive the event information and store it:

The so called “push” is the simplest way to use webhooks. As we already mentioned, there is no need to be polling your data every few minutes to find out if there is new information. You can just get the new information directly by using webhooks. You will be able to store it till you need it for something else. Basically, the system you configured with your webhook will PUSH the information you need when it arrives.

To receive the event information and pass it on:

The so called “pipe” happens when your webhook not only receives the information for which it listens, but goes on to do something new with it, like triggering actions. You could create a script, register its URL on your site, and send an email when a visitor creates an account. Or create a script that updates the quantity of products available every time a new purchase is made.

With webhooks, you can actually do whatever you want or need! And it is simple and efficient, because you are not wasting your time requesting for enormous amount of data – you are receiving the new data when it arrives!

How can you use webhooks with Mailjet?

With webhooks, you can easily receive each open or click event right after it happens, or track bounces and blocks as they happen. Imagine that in 15 minutes more than 60% of your emails to a destination are blocked? Thanks to the events you are receiving in real time, you’ll be able to detect this immediately and take action.

You can always use the events to create your personalized dashboard in whatever internal application you use, to process the data you want as you wish. You’ll only have the events you need and track the most relevant data. Or you can use the events received on your webhook as triggers for a new email to be send, to create a personalized automated flow for all of your users.

Mailjet event examples

Let’s dig a bit deeper into what the events you receive on those webhooks look like.This is what you’ll get when you receive an open event:

“event”: “open”,
“time”: 1433103519,
“MessageID”: 19421777396190490,
“email”: “api@mailjet.com”,
“mj_campaign_id”: 7173,
“mj_contact_id”: 320,
“customcampaign”: “”,
“CustomID”: “helloworld”,
“Payload”: “”,
“ip”: “”,
“geo”: “US”,
“agent”: “Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0”

You can see what message was opened, when exactly and other useful information that you can use however you wish.

Now, let’s check out a bounce event:

“event”: “bounce”,
“time”: 1430812195,
“MessageID”: 13792286917004336,
“email”: “bounce@mailjet.com”,
“mj_campaign_id”: 0,
“mj_contact_id”: 0,
“customcampaign”: “”,
“CustomID”: “helloworld”,
“Payload”: “”,
“blocked”: true,
“hard_bounce”: true,
“error_related_to”: “recipient”,
“error”: “user unknown”

Here you can also see what the error was, in the field “error”. In this case, the error indicates it’s an “unknown user”, which lets you know that it is better not to try and reach out to this user again. This could be used to synchronize two systems to clean your lists from inactives or incorrect contacts.

In shortly, you can do anything with the events you receive from Mailjet. Use them in your configuration and create what you need!
How can you configure a webhook with Mailjet?

First off, you’ll need the URL from the system from which you want to receive the events. Once you’ve got that, everything else is really simple. That URL will accept data and can activate a workflow to turn the data into something useful. There are two ways to configure your webhooks in Mailjet.

  • Using our API;
  • Using our interface;


Using our API

You will need to make one simple call to setup the URL you want to use. Here’s the call:

curl -s \
https://api.mailjet.com/v3/REST/eventcallbackurl \
-H ‘Content-Type: application/json’ \
-d ‘{

This URL will listen for open events. Each time anyone opens your email you will receive an open event like the one we saw above. Then you can either just store the data or trigger an action, such as sending a new email.

See, it is simple! One call and everything is done. Check out our documentation to get started.

Using our interface

We offer the option to configure the webhook from our interface as well. You can do it from the “My account” page, on the section “Rest API”. You’ll need to choose the option “Event tracking (triggers)”


You’ll be able to add one webhook for all events, or set up specific ones for each type of events.


You will be able also to test the URL you specified to ensure it’s working properly. If all goes well, it will return a 200 OK HTTP. Any other HTTP code will result in our server retrying the request later.

Our system will retry following these rules:

  • 10 attempts, with 30 seconds between each attempt;
  • After that:10 attempts, with 30 minutes between each attempt;
  • If none of these attempts work, the URL will be suspended;


Keep an eye on your webhook for any responses other than a 200 OK. 😉

And this is it! You have a functional webhook that can receive your email events. Use this in your configuration to have your own statistics or custom workflows.

Summing Up

Now you know what a webhook is and why this is the easiest way to track any type of events over the web. Just set up your “listener” and decide what to do with the events it catches.

Using Mailjet’s events will help you track everything that happens with your emails. This is the perfect way to clean your lists or to create your own dashboard in your company’s internal application.

If you want to be the first to know about the latest tech trends or how to use Mailjet, follow us on Twitter and Facebook.

Advanced Email Personalization Using Mailjet’s API

In our previous post in this series we explained what personalization is and provided some useful tips on how and when to best add personalization to your campaigns. We also showed you how to apply standard personalization either manually or using our awesome email builder – Passport. If you missed it be sure to check out our previous article here.

In this article, we are going to dive even deeper into the world of the personalization. Do you want to know how to get to the next level? ? Keep reading and you will see the magic of the advanced personalization, which will allow you to create the perfect email for everyone.

What is advanced email personalization?

Advanced personalization is the easiest way to customize your emails with data that it is collected by your CRM or any other tool you are using to collect your customer’s information. At the moment, this type of personalization e can only be used for transactional emails at Mailjet and by using our template language.

While advanced personalization allows you to do everything we covered in standard personalization, it goes well beyond that.. Not only can you customize [first name] and other basic variables, with advanced personalization,you can customize the content of your email as well, allowing you to send fully personalized emails.. We’ll show you a little later on how exactly you can do this but first to do any kind of personalization you will need personal data for your clients to use.

What data can you use to personalize your email?

The most basic method of collecting information is through a subscription widget You can ask your customers and prospect any number of qualifying questions as they are subscribing to your emails, or opening an account. Starting with their name and email of course, all the way to questions that are going to help you provide a truly personal experience in your campaigns.

For example, if you are selling tickets for events, you could ask “What type of music do you like?” or “What type of movies do you like to watch?” or maybe “Do you prefer live music or live theater?”. get a better idea what to propose to each customer.

But are there other ways to collect data from your customers without asking them additional questions all the time? Yes, you can collect the data for advanced personalization using behavioral website tracking or integrations.

Behavior website tracking

Using behavior website tracking you would have the ability to collect more data than you would ever need about your website visitors using conversion rate optimization (CRO) tools.

User behavior are the activities that your visitors are doing after they land on your site. It could be clicks, scrolling through pages, reading blog posts, taking quizzes, and anything else you think will be useful to you. This could be really helpful at any time of the year,or example if you are tracking that Mike is browsing for items for his wife Laura and his 5 year old boy Jake, you can send him an email with suggestions for the perfect presents for his family.


Another good option would be to use integrations. Get subscriber data such as past orders, total money spent, location, purchase data,and more, by integrating your email marketing tool with your CRM or e-commerce platform. There are a lot of integrations that could do all the work for you and you will just have to create the basic template, all the rest will be done automatically. So, at the end your recipient will get a perfect personalized email. For example if you are using our integration with Mautic, you could create a preference center using their how-to article.

Okay, now we have all the data that we need for our emails. Let’s see how to use it with our advanced personalization option.

How to use Advanced Personalization?

When it comes to personalized content, how you can decide which part of the content to be shown to specific targets? When the emails speak to what the subscriber wants to read about, your customers are much more likely to engage with them. Hence, you need to be sure that you offer email content that are targeted and relevant to the recipient. Now that you have all the data and segments set, create emails that are most suited and targeted for each individual subscriber.

Dynamic content is something that you can easily do with the our advanced personalization or the so called template language via our API. You can easily mix up the simple and the advanced personalization in one template, so you would have one beautiful email at the end.

What is the difference between both types? As we saw, standard personalization is taking the information from the data you provided while uploading your list at Mailjet, so we already have this information on our side.

But advanced personalization is actually asking your systems about the information that we should display in the email. In the API call you are going to set up the properties and configure the path to the destination from where the API call should take them.

There is a slight difference also in the way the both type of personalizations are being set up. If you are creating your template in Passport to use the standard personalization, you can use the way described in our previous article, or manually by typing:


The advanced personalization could be set up by manually typing the following syntax:


As you can see the only difference is in the type of variable – one is data and the other is var. You can add it in this way in Passport or in any MJML/HTML template you are creating.

The way you should define those properties in your API calls, depends on the API version you are using.

  • In Send API v3.1 you should do it with the following piece of code:
"Variables": {
              "day": "Monday"
  • In Send API v3 the code is:

In the API call you can set up the path to the destination from which the variable should be taken. Our system will call this destination and replace the property with the value your system sends us.

Using Dynamic Content to Personalize Emails

One of the useful features of the template language is the dynamic content. Using conditions and loops, you can show part of your content only to the recipients you want.

You won’t recommend Mike buy his wife Laura men’s shoes right? Or his son a kitchen dining set?

We know that you can create such dynamic content using HTML without any issue, but now this is possible with Passport as well. Simply drag and drop the template language section wherever you want within the template, like shown below:


You can create any condition, or loop where the content can be shown to each of your segments. You can also use any information that you have saved in your CRM or database. For example age, gender, city, or interests. If you are using behavioral website tracking, this could also be used as source of information.

Another option would be to segment a whole section using Passport. To do this, you will need to select the section you want, and in the upper left corner you will have the option to add a property and segment based on it.


Click on “Add condition” and configure the right option for your specific use case. You can choose whether the property should be equal to a specific term, or greater than a value, or less than any value you choose.


You can find everything you need on how to use the dynamic content with our template language in this article.

Personalizing the content and copy of the email boosts engagement and loyalty. Sending tailor-made and relevant content increases the click-through rates of your emails. By dynamically changing content, you will be able to send the most relevant emails to every subscriber. They will see offers and products that they are more likely to be interested in, thereby increasing the likelihood of a purchase.

What can you add as dynamic content? Almost anything! Here are some ideas to get you started:

  • VIP Loyalty section – categorize your subscribers based on their purchases and send specially tailored offers and discounts to them. This will help your brand engage customers stronger and drive revenue.
  • Recommendations – when you send recommendations based on a recent purchase, there is an increased chance of them purchasing the recommended products.
  • Wish Lists – you have an item that a customer added in their wish list? Add this as a reminder in the next email you are sending them. They might still want it.
  • Abandoned Carts – someone left behind an item in their cart? Remind them about how awesome that product is, hey they may still want it. You can see how to code abandoned cart emails using MJML in our tutorial.
  • Birthday/Anniversary discounts – what better way to celebrate a birthday than by providing them a discount? You can do the same when someone has been with you for a month, a year, or any anniversary worth celebrating.

Summing Up

The best part is that all of this can easily be done with our email builder Passport! And you will only need to define the variables you used for the advanced personalization in your API call.

You can create one template that full of variables, but everyone of your subscribers will receive an email that is perfectly customized for them. Don’t waste your time with different templates for all your customers You can easily have one template that will adapt to the customer.
With the strategies listed above, you can set up a winning personalized email strategy for your business. Your customers receive dozens of emails everyday, so your email needs to stand out. Personalization can do this for you! Try it out and see how your emails can build stronger relationships between your brand and your customers.

If you want to be the first to know everything new about how to create great emails or use Mailjet in the best way, just follow us on Twitter and Facebook!

How to Personalize Your Emails with Mailjet

Email personalization is a tactic used by a lot of brands today, but frankly not enough. We do it… do you? 😉Of course, there are good reasons for this. Personalized emails are much more likely to be opened and clicked, because in a endless feed of content, those messages tailored made for you are much more attractive. In fact, as you’ll see below, simply including a name in the subject line will increase open rates by 20%, boost sales leads by 31%, and reduce unsubscribes by 17%

In this article, we will dig deeper into:

  • Effective ways to personalize your emails.
  • Why using personalization in emails is important.
  • How to use Mailjet to personalize your emails.


When you look at the full benefits of email personalization, this is just the tip of the iceberg though.

What is email personalization?

When it comes to email, personalization means leveraging the information you collected about a customer to target their interests and personal attributes. It could be something as simple as using their first name, where they live, something they bought recently, or perhaps something based on their behaviour on your site like downloading content or saving an item in a check out cart.

In short, email personalization can help you:

  • Customize an email subject line to stand out in the inbox;
  • Increase the likelihood of an email being opened and clicked on, when the personalized content is previewed within the inbox;
  • Improve customer experience by sending the right content to the right person at the right time.

Why should you personalize your emails?

We’re sure that by now you’ve already received your fair share of emails with your name in the subject line. Well, something as simple as adding the contact’s name in the subject line can mean a 20% higher chance of getting your email opened.

And now if you receive an email with the subject “Hey Sarah! Find the perfect gift for you and your friends!”, wouldn’t you be interested?

But customizing the subject line is just the first step. Personalization allows you to tailor email content so the reader feels it has been handpicked for them. Personalized email messages improve click-through rates by an average of 14% and conversions by 10%.

As we predicted earlier this month, 2019 will be the year in which brands finally fully embrace relevant messages. Segmented and targeted emails could actually generate more revenue for you and your brand, so can you really afford to continue to neglect email personalization?

What do you need before you start using personalization?

To start personalizing your emails, you’ll obviously need to collect the relevant data from your subscribers, users, and customers. Any data that gives you deeper insights about an individual can be used, from their date of birth, to their city, to their cat’s name. The more information you collect, the more targeted your email campaigns can be. You can collect this data using signup forms and subscription widgets when people create an account or subscribe to your email list, as well as tracking behavioural data such as which links they click in your emails or website actions.

With signup forms and subscription widgets, apart from the standard name and email address information, you can collect extra data such as gender, location, birthday, etc. Capturing extra details helps you in creating more personalized and targeted emails.

How to add personalization to your emails using Mailjet

Mailjet offers standard (simple) personalization that can be easily used thanks to contact properties on Mailjet’s platform. This can be used directly on our email editor, Passport, without having to make any API calls to define the values. Standard personalization can be used on both marketing and transactional emails and can help you when you already have all the data you need stored as part of your contact properties. But what if you don’t?

Well, then there is the option of advanced personalization that could be used through Mailjet’s Email API if you have these values as properties in your CRM. This type of personalization can only be used on transactional emails. We will talk more about that in a future article. :-)

To use standard personalization, however, you just need two things:

  • All the variables already set up as contact properties, and added into your Mailjet account.
  • An amazing guide to learn how to set up the variables in your template (like this post? 😎).

If you need help creating and adding properties, click here.

So, what can we do with simple personalization? Almost anything we want, if the all the necessary information is uploaded to, or integrated with, Mailjet. You can personalize subject lines and content within the email with predefined values, such as your contact’s cat name (we’ll keep pushing this idea until someone uses it 😼)or the city they were born in.

How to personalize your emails using Mailjet’s Passport

Using personalization with our email editor, Passport, is really easy. Once you have your beautiful template ready, it will only take a few minutes to add in all the necessary variables. You will not need deep technical knowledge on how to code, or use any strange Klingon-sounding language to you.

A variable is the value a contact has for a certain property. For example if the property is “firstname” and your name is Jake, then in this case Jake will be the variable for the property “firstname”.

This is why we made it really easy for you to add a variable to the subject line or body of the email by just clicking two buttons. We’ll show you how easy it is to do this in the examples below.

In the subject line

When you’re creating a campaign, the second step in the process allows you to choose your email’s subject line.

Personalizing the subject line is something you can easily do right away. Just create your subject line and click on the “Insert variable” button wherever you want to add the variable.


A new window will pop up and you can choose the variable you want to use and set up a default value to show if the property’s not available for a particular contact.


Here’s how the subject would look like in our editor.


If everything is set up correctly, the property will be replaced with the value that is associated with each contact once you send your email. And here’s how it will look in the inbox:


But what happens if there is no value for some of the recipients?

This is when the default value comes into play, as it will be displayed for those contacts that haven’t provided information for that specific property (for this example, it could result in something like: Hey there, did you know about this?). Of course, if you are using variables, you will always want to have something set up as a default value, as otherwise that variable would be blank and the personalization wouldn’t really work with odd blank spots.

“Hey , did you hear about this?” is just a little too annoying.

In the content

And what can Mailjet do to help personalization the email’s content? Well… anything you want!

You can use personalization to add the name of the recipient once again, or anything else that is going to help you address your customers better, and send them the content they would like to receive.

This type of personalization can be used on both marketing and transactional emails. Although there is a slight difference when adding variables in marketing and transactional emails. The first step is either case is the same though: you’ll have to choose the tab ‘Variables’ from the option menu in the content block that you want to add your personalized content.


Next, a window will pop up, which will be a bit different depending on whether you’re working on transactional or marketing templates.

Let’s have a look at what that pop up will look like when you’re creating your transactional templates:


On your transactional templates the pop-up window will include the following types of variables:

  • Custom transactional variable: to be used when adding advanced personalization.
  • Contact property inked to the properties in your Mailjet contact list. The Contact property is the one we’ll be using to add standard personalization to your emails.


Just like we did before, all you need to do is choose the correct contact property and set your default value. Then, our system will compile the syntax and add it in the template. Easy, right?

And what about your marketing templates? Well, in that case, the pop up window that comes up will look something like this:


You’ll be able to choose between two types of variables:

  • Contact property: which we’ll be using (as we’ve done before) to add that standard personalization.
  • Predefined tags: which can be used to add things like unsubscribe links, social sharing links, and more.


We won’t be looking into predefined tags today, but you can learn more about how we use them for things like unsubscribe links here.

Once you’ve defined the contact property and default value, your content will look like this:


But in the recipient’s mailbox it will look just like this:


How to personalize your emails using MJML or HTML

Of course, if you are creating your emails using MJML or HTML, standard personalization is still an option for you. All you need to do is add this small piece of code into your email and our system will do the rest.


For example: [[data:firstname:”Everyone”]]

That’s all that’s needed on your side. Mailjet’s system will find the value associated with this property and replace it. This syntax can also be used in Passport, if you prefer to do everything manually.

Here’s how the same personalization we did above will look if it is done with MJML:


Once the email is sent, it will look the exact same way as the one created with Passport.

Summing Up

You can easily create a personalized email that will make everyone want to open and check your email (well maybe not everyone, but definitely a lot more people).

We’ve showed you how easily it is to personalize your email subject lines and content using our email builder, Passport, just by following these simple steps.

And if you think this is getting too easy and want to step up your personalization game, stay tuned to learn how to use advanced personalization and dynamic content!

Want to be the first to know about our new tutorials and useful guides? Don’t forget to follow us on Facebook, Linkedin, and Twitter!

Which SMTP Port Should I Use with Mailjet?

Choosing an SMTP port can be tricky. If you’re configuring your email system to send or relay email, you’re probably wondering: “Which SMTP port should I use?”. Sounds tough…

To be honest, there are a few things to take into consideration. Do you need some kind of encryption? Or would this port be open at the recipient’s end for receiving emails? Does the email service provider you use support this port?

Yes, we know. There are so many things to think about, it’s easy to get lost… Which is why, in this article, we will help you find the answers you need to find the right configuration for you.

What is SMTP?

Simple Mail Transfer Protocol or (simply SMTP) is the basic standard that email servers use to send email to one another across the internet. SMTP is also used by some applications and services to relay their users to other email servers. Using a process called “store and forward,” SMTP moves your email across networks. It works closely with something called the Mail Transfer Agent (MTA) to send your communication to the right computer and email inbox. MTA is each software app used by email clients (e.g. Gmail, Outlook, Apple Mail, etc.)

SMTP could also be used as a TCP/IP protocol to receive emails, however, since it is limited in its possibility to queue messages at the receiving end, it is usually used only for sending. POP3 or IMAP protocols are used alongside SMTP for receiving emails that let the user save messages in a server mailbox and download them periodically from the server. Not so complicated now, right?

What is an SMTP port?

Let’s start with what is a port.

If we are talking about a networking port, it’s not like the ports that let you charge your computer or plug in your mouse to your computer. Ports actually have a very specific and very well defined meaning when it comes to digital communications

To understand how ports work, we need to take a step back and see what happens when computers communicate with each other on the internet.

Let’s say you are trying to reach mailjet.com. In this case, the Domain Name System (DNS) is converting this to the actual IP that is hidden behind the name of the site. In Mailjet’s case, this is You probably could remember 4-5 IPs like ours, but who can actually remember more, or really… who would want to?


So, now your server is requesting to connect you with this site from your ISP.

What’s next? Here’s where the port comes in handy.

We know that the address we want to reach and the port number (80 in this case) tells the server what it is you want it to do. You can think of the ports as the number of addresses you would like to reach. The IP address would be equivalent to the physical address of the recipient, and the port number might be the individual within the street that’s supposed to receive your letter.

In other words, a port is an endpoint to a logical connection. At the software level, within an operating system, a port is a logical construct that identifies a specific process or a type of network service.

The port number identifies what type of port it is. Some ports have numbers that are assigned to them by the IANA, and these are called the “well-known ports”, which are specified in RFC 1700.

Each port has two stats – open and closed. If the port is open, it means that you can establish a connection and transfer the information. If the port is closed, you won’t be able to reach it and the connection will fail.

You can actually check if a port is open or not by telnetting it. How to do this? That’s too much for this post, but you can learn more about it in this detailed article.

An SMTP port is one that is meant to be used for SMTP connections. Today, the most common SMTP ports are 25, 465, 587, or 2525. This doesn’t mean that they are the only ones, though. These few ports are the most used ones for these types of connection, and because of that they are almost always opened, which means you should be able to reach your destination. OK, we know that you are excited to learn more 😉

Mailjet’s SMTP relay

Mailjet’s robust delivery infrastructure routes billions of emails to the inbox every month. Our free SMTP relay could be set up in minutes and you will discover just how our powerful features can help you do more with less.

If you’re using Mailjet for sending your transactional emails through SMTP, it is pretty easy to set this up! Once you have created your amazing templates, you can follow this article to configure your SMTP connection. You can do this with any desktop client, such as Outlook or Thunderbird. But even better than that, you can use MTA and MDA, such as Postfix, exim and Exchange.

Of course, you can set up the SMTP relay with any technology that supports SMTP, so you can choose the perfect framework or language for you. What could be easier, right? 😎

Just add your API key as the username and secret key as the password and set up the host/smtp server in-v3.mailjet.com. And now, let’s see what ports we offer for you to use.

Port Purpose TLS SSL
25 Simple Mail Transfer Protocol Port Optional No
80 Hypertext Transfer Protocol Port Optional No
465 Authenticated SMTP over SSL Port No Yes
587/588 Email Message Submission Port Optional No
2525 The Alternative Port Optional No

You can see all the details for these ports below:

Port 25 – Simple Mail Transfer Protocol Port

Every systems administrator (at least of a certain age), knows that SMTP was designated to use port 25 in IETF Request For Comments (RFC) 821. Today, IANA, still recognizes Port 25 as the standard, default SMTP port.
Although port 25 continues to be the most common port for SMTP relaying, most modern SMTP clients could be blocking this port.
Why, you ask?
Port 25 is blocked on many networks because of the spam that has historically been relayed from compromised computers and servers. So, it is true that many ISPs and hosting providers block or restrict SMTP connections on port 25. This helps to cut down a number of unsolicited emails that are sent from their networks.
However, if you are managing an email server you can always decide to leave port 25 open and allow SMTP connection through it. You can implement other securitization on your server, such as frameworks and additional email verification to prevent the sending of spam.

You can use TLS encryption with port 25 with Mailjet.

Port 80 – Hypertext Transfer Protocol Port

Port 80 is the port number assigned to the commonly used internet communication protocol Hypertext Transfer Protocol (HTTP). It is the port from which a computer sends and receives web client-based communication and messages from a web server, and is used to send and receive HTML pages or data. This is the port that the server “listens to” or expects to receive from a web client, assuming that the default was taken when the server was configured or set up.

And you know what the best thing is about using this port? It is open 99.9% of the time! So the chances of your email not getting through are pretty slim. Everybody needs access to the internet and they need this port open.

You can use TLS encryption with port 80 as well.

Port 465 – Authenticated SMTP over SSL Port

IANA initially assigned port 465 for an encrypted version of SMTP, called SMTPS. By the end of 1998, IANA had reassigned this port number to a new service. But still many services continue to offer the deprecated SMTPS interface on port 465. We are one of these services. 😉

The purpose of port 465 is to establish a port for SMTP to operate using Secure Sockets Layer (SSL). SSL is commonly used for encrypting communications over the internet. Typically, you will use this port only if your application demands it.

This is the best way to use a more secure SMTP connection. Port 465 is the only one with which we are accepting SSL encryption.

Port 587 and Port 588 – Email Message Submission Port

Nowadays, port 587 is used for secure submission of email for delivery. Most of the client software are configured to use this port to send your messages. Almost all mail servers support this port. But even if the mail server supports it, it may or may not be open for mail submissions.

With Mailjet, this port is open. To see if it is the same for your destination, you can use the telnet technic.

Using port 587, you can couple it with TLS encryption while using Mailjet. The same applies for port 588.

Port 2525 – The Alternative Port

Port 2525 is not an official SMTP port, and it is not sanctioned by the IETF nor IANA. Almost every ESP supports the use of Port 2525, even though this is not an official SMTP port. It could be used as an alternative to port 587 for SMTP, in case all of the other pots are being blocked.

Port 2525 is probably the most used by users that are hosted on Google Compute Engine and experiencing connectivity issues with port 587.

This port also supports TLS encryption.

What we learned together

Now you can say that you know what an SMTP and network port is- well done, you! Even better, you now know the purpose of some ports and that you can use them for SMTP connections and relays. You can also check if a port is opened in your configuration or the recipient’s one using telnet. 😉

We are sure that, now, if you have any issue with the SMTP relay between Mailjet and your own server, you will know what to test and see if there is an issue with the port connection.

Want to know more about SMTP and Mailjet? Follow us on Facebook and Twitter to be the first to know about our new articles!

How to Set up Template Error Management and Why We Need It

Testing your email templates is tough. Who wants to be checking thousands of code lines for 50 different templates?

That’s why choosing a bug reporting process is necessary. At Mailjet, we are trying to make it as easy as possible for you to do this with our Template Error Management options. Read on and we’ll tell you what Error Reporting is and why you’ll love it. 😉

What is Error Reporting

Good error reporting is essential when building and debugging email templates. No one wants to look at a template for hours, just to see that one small comma is missing…😒 You know the feeling when you want to break your screen with your keyboard? We do and we know how unpleasant it is.

Collaboration Toolkit

As you can imagine, filling out manually a big bug report can take a while. If you need to report dozens of bugs during a testing session, it could take you several hours for one template… This would be painful.

There are many different elements you can include in your bug report. However, using a bug tracker is probably the best way for your organization to move bugs from reported to fixed and help you stay focused. As powerful as bug tracking tools are, the big problem is that you need every person working on the templates to use them and to know how to manage them. But how do you explain to a marketer what “node” means? 🤷

Mailjet’s error reporting is super easy to use for developers, because it gives you a headstart and shows you what to fix and where. For non-developers, it helps to provide more details to you instead of having to rely on insufficient information like say “I got blank / white page”. We all know how no one touched anything, but still something is not working…


Template Error Management at Mailjet

Our goal at Mailjet is to make our products as easy to use as possible. You already know that using our template language is a piece of cake, but it is possible that you missed one curly bracket or a variable was not written correctly and this is breaking everything.

Or you sent the template to the design team to put all the appropriate colors for your brand and someone removed something that seemed strange to them. In fact, it was the most important part of the amazing loop you created.

We don’t want you to waste your time digging into what went wrong, and so we built a solution for you – Template Error Management! We are offering two options:

  • Template Error Reporting
  • Template Error Deliver

Template Error Reporting

Have you ever sent an email but it was not delivered? This could be because our system detected an error with your template and aborted the sending. The main purpose of our template error reporting option is to send you an email to let you know that there is something wrong and provide a detailed explanation of the issue. Here is how it works:

  1. You create a beautiful email template
  2. You compose your API call and declare all of your variables in it
  3. The email is sent by you to our system
  4. Our system checks the template and replaces all the variables with their corresponding values
  5. Our system finds an error
  6. The sending is stopped unless you chose otherwise
  7. Mailjet sends you an email with the error details

So, the first two steps are something that you usually do just perfectly, but this time there was one small mistake in your template. If you have one big template full with loops and conditions, checking everything manually could take forever. This is why we are offering our template error reporting.

To activate it you only need to add this piece of code in your API call:

"TemplateErrorReporting": {
"Email": "youremail@yourdomain.com",
"Name": "Your name"

It is important to write the correct email address, because our system will send the report to this address.

These reports should not be an issue for you because the errors are pretty self-explanatory, but we’ve provided some examples of the most common errors below:

unexpected end of template:unfinished end of node ## near ## {{var:url – One of the variables are not closed correctly. In our example above, the variable is missing two closed brackets (i.e. }}) at the end and because of this our template language engine is not recognizing it and cannot compile the template correctly.

not valid template – the template you chose is not the correct one. Most likely the ID does not correspond to the right one. Our system is not detecting the variables you declared in our API call in the template, so you should first check if the template’s ID is correct.

unknown node ## near ## – There is a syntax error in the template. You should check if you have declared all the loops in template language sections.

“var:firstname” is not an array value – This error is generally returned when you try to loop on a non-array value. If you set up a loop as this {% for fn in var:firstname %}, you should declare something like this in your API call: {“firstname”:[“Jane”,”Joe”]}. If this is not declared, our system cannot compile the variables.

No value for “var:items” – you haven’t set up the variable in your API call. If a variable is not declared, our system is not able to replace it in the template with the corresponding value. We don’t want to send a template with {{var:items}} in it, because the recipient wouldn’t know what this should be.

expression parsing error ## Unknown identifier: var:day ## near ## {{var:day ## – This error indicates that the “day” variable is not defined in your Vars. It can be fixed by adding the default value for the variable or making sure that you pass all the variables required by the template.

expression parsing error ## Unknown identifier: day ## near ## {{day ## – This error is similar to the previous one, except for the absence of namespace (var or data). It can indicate that you forgot to specify whether you want to use a Send API variable var:day or a contact property data:day. It can also indicate that you are trying to use a template variable that is not defined in a set function nor a loop statement.

not valid template ## near ## y}} ## – This error occurs when the statement is not finished – missing {% endif %}

What should you do when you receive ## Unknown identifier: var:day ## near ## {{var:day ##, but you don’t see such variable in your template?Well… did you update the plain text version of the template? If the plain text version of the template is not updated, it still contains all the old variables and our system is still trying to compile them. This is why it is better to use our template error reporting. It is much easier for you to manage your templates and to fix some small errors that happened for any given reason.

Template Error Deliver

This second option determines if the message should – or should not – be delivered to the recipient in case of an error while processing the message’s template language. If the below line is not added in your API call, our system will assume this option is not enabled by default:

"TemplateErrorDeliver": true

What does it mean? If you don’t have this small code in your API call, in case there is any error in your template, the email won’t send. Our system will detect the error, it will send you an email with the error report (if you have switched on the Template Error Reporting option of course), and it will not proceed with the sending of the template to your recipients.

However, if you are still in the testing phase, it might be helpful to have this activated. If there is an error in your template, you will receive the error reporting, but you will also receive the uncompiled template itself. Our system will detect the error and will send you the error report email. However, our system will also see that the Template Error Deliver is active and it will send the emails anyways, just as they are.

So the recipient will see all the loops and variables without them being replaced with the data you set up in your API call. Yes, the template won’t look as pretty as it should (and as you and your great design team created it), but it will give you some general idea on how the template will look.

If you want to avoid any errors once your templates are in production, it would be better to remove “TemplateErrorDeliver”: true from your API call. You won’t risk having your template delivered, which will avoid any confusion from your contacts.


It is still helpful, though, to keep the Template Error Reporting element active so you can receive an email if there is something wrong with your template.

Template Error Management helps you resolve all issues with the template language in your email templates without losing a lot of time and nerves. Our dedicated API support is always here to help you resolve your issues, if you need any additional help identifying the problem or understanding the error you received via email.

If you want to be the first to get the next useful tips we are going to publish, follow us on Twitter and Facebook. Make sure not to miss a thing!

How To Code An Abandoned Cart Email With MJML

You know how many customers are leaving some items in their carts without processing to the actual purchase? We’re here to make sure you’re ready to give your customers that extra nudge and remind them about those items they once left behind in their carts. Even better you are going to make them even happier, by telling them that those items are on sale. 😏

If you’re a thorough follower of our tutorials, you may already know that, we’re showing you how to create and send awesome transactional emails step by step. We’ve already showed you how to create welcome email and email receipt using template language and MJML. Now, you’ll learn how to create abandoned cart emails.

A templating language for your transactional emails

Are you tired of creating a separate template for all your needs? Template language is here to offer you the best solution! You’ll be able to create one template for all your purposes using our template language.

Template language is available in different languages and using multiple libraries, so you are probably familiar with at least one of them. It’ll be a piece of cake! 😉

Mailjet’s Templating Language

At Mailjet, we know the value of a fully integrated templating language, which is why we created our own templating language with our Transactional Send API in mind. We’re here to help you manage everything in one template, to save you time and effort.

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. That’s why 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 an abandoned cart: Quick Introduction

Today, we’re going to see how to implement an efficient abandoned cart email using MJML, the open-source email framework with 7600+ stars on Github open-source email framework, and our templatе language. Here’s a quick preview:


When a customer adds products to their cart but doesn’t check out, it doesn’t mean the sale is definitively over. Here are some numbers for you: 50% of abandoned cart emails are opened, and more than a third of them trigger clicks to redirect customers to the website. And these figures could be even higher during a sale, when you’ll have the chance to offer your customers that additional tempting discount.

This high rate can be easily explained: customers often abandon their carts without meaning to do so, be it because of website crashes or times out (sure, that never happens to yours), or simply because they needed some time to think. This is why an abandoned cart email can be a successful way to re-engage customers, guide them through to the last step in your buying process or allow them to recover lost purchases.

A proper abandoned cart email should include the following:

  1. The items left in the cart.
  2. An incentive, such as a discount or a special deal, personalized for your user.
  3. Some new articles your user may prefer.

Let’s focus on these points.

How to create an abandoned cart email

You should encourage your clients to resume their shopping experience, just where they left it. This implies that your email template should display the abandoned cart, just as it looks on your website, both in terms of design and in terms of the items left behind. Easy to say when you’re using the [name here any trendy JS framework], but how do you do this in an email? The solution: use our templating language loops and variables directly into your email to display a cart based on raw JSON data.

Coding the abandoned cart section

Let’s start from the top of the template. We are going to use mj-navbar as container. We’ll choose this container as it is better suited for our needs and it’s already formed by two mj-column. The first one will contain mj-image and the other one the mj-inline-links component, which will create your links based on a list of mj-link children.

Of course we are going to add some CSS code to make our template prettier and here’s what we have:

Coding the body of the template

Now, let’s see how to code the main body of the template. As a general rule, it is recommended to keep it as close as possible to your cart’s main design on the website. Here’s our code:

As you can see, we’re using two nested mj-section. We’ll do this because the MJML API we’re using for this tutorial does not support the component yet.

Defining the items in the cart

Next, we’re going to configure everything related to the items in the cart. To do so, we are going to set up this loop {% for single_element in array_variable %}, using the following pattern: {{ var:property_key:default_value }}. Within the loop, a new variable single_element is created and updated for each iteration, ready to be used.
Here’s the MJML code for the display:

If you want to know how to set up your API call, visit our documentation here.

Coding the section with the additional discount

We are almost done! Now we need to let our customers know the good news! There are sales, oh surprise, the items that they left behind are now with discount! Who doesn’t love discounts? Probably some customers abandon their carts because they initially thought your products were cheaper. Hold on… Where did all these taxes and shipping fees come from? Well now, with the discount on the items, the customers won’t even notice those additional costs.
Here again, we’ll use a mj-table to display two sub-columns:

To win these customers back, the best way is to issue a discount or offer them free shipping, in the form of a deal that looks as if it was directly branded for them. To do this, add blocks to your template that only show up under specific conditions. In this tutorial, conditional blocks come to the rescue.

How to code section with other suggestion

Abandoned cart emails can provide a nice opportunity to present other products. You surely have a nice algorithm for recommendations – use it to generate some JSON data and, with our templating language, display nice personalized blocks directly in your email.

How to code CTA button

This is the easiest part. 😉 To add the CTA button, just use the code below for the mj-button:

Time to jump on Github

OK, we’ve given you an overview and some code examples to create an amazing abandoned cart email. Now it’s time to create your own with your own design.
You’ll find everything you need on our detailed tutorial on Github, complete with examples and code samples.

Github-tutorial-blogpost-banner 4

Have you missed the previous tutorials? Check them out here:

How to create an e-commerce receipt email

How to send a welcome series email

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.

Do you want to be informed about the next tutorials? Come and say “hi” on Twitter or join us for a chat on Facebook