How to integrate Mandrill (transactional email API) into any code

Mandrill is a great API for sending transactional e-mails, and on this page we will look into how to implement it. In practice it does require developer skills, and if you need any help with that, contact us.

What is Mandrill and is it “better than Mailchimp”?

Mandrill is made by the same team that made Mailchimp, the extremely popular newsletter tool. But it’s extremely important to understand that Mandrill and Mailchimp are not the same tool.

In order to explain what Mandrill is, let us understand what Mailchimp solves.

Mailchimp is a tool to send out newsletters. Mailchimp is based upon lists of recipients, who have signed up to receive a newsletter. In Mailchimp these lists can be managed, and you can manage what content these people should receive.

Mandrill is an API. Mandrill is meant as a SaaS solution, which programs and websites can use as a backend to send transactional e-mails. Transactional e-mails are emails such as order confirmations, user signups, forgotten passwords and anything that the user may receive during normal use. Mandrill is not used to send newsletters, it is used to send these transactional emails the users need.

Something we’ve heard a few times is “Is Mandrill better than Mailchimp?” Such a question makes absolutely no sense, as they are used for two very different things. Mandrill is used to handle newsletters, Mandrill is an API used to send transactional e-mails.

How to implement Mandrill into any solution?

Mandrill is a simple REST api.

By creating an account at Mandrill.com, you can get your API keys, and then you are ready to make calls to Mandrill.

There are two different types of e-mails you can send with Mandrill:

  • Send. If you want to handle all the HTML to simply send everything in the e-mail, you can use the send method. By doing this, you can just send an e-mail with any content you like, to any e-mail you like.
  • Send template. In Mandrill you can host a range of templates with variables. By calling this endpoint, you don’t have to provide any HTML, only the variables needed.

Both are simple API calls, which can be done in any program language and tool.

Use Mandrill templates or send HTML?

When using Mandrill, it’s a key decision to pick either templates inside Mandrill, or send actual HTML.

The decision to use one or the other always depends on the actual use case. In some situations it make sense to control the HTML yourself, in other cases it makes sense to use the Mandrill templates.

Here we will discuss both use cases.

Handle HTML yourself. In some cases you simply control the whole HTML in your end. It could be that you have some internal tool to create newsletters, the e-mail could be extremely simple and have no design elements, and many other reasons.

In this case Mandrill is seen as a very thin shell which sends the newsletters. Here, no actual responsibility besides sending the actual e-mail is given to Mandrill.

Use Mandrill templates. Everyone can use Mandrill templates to log in and edit the content and layout of the e-mails which is being sent.

The templates can then contain variables, which the caller of the API is responsible for sending.

Use both Mailchimp and Mandrill

As Mandrill and Mailchimp are made by the same company, the two tools are easy to use together. It also makes sense to extend your use to Mandrill,  if you already use Mailchimp.

If you have templates inside Mailchimp, it’s possible to export these to Mandrill. This can be done with a single click.

Get help with implementing Mandrill

We can help you do the implementation. Just contact us, and we’ll will find the right solution.