Out of the box, Drupal offers the rudimentary ability to send automatic email notifications, such as Account Activation or Password Recovery emails. These are examples of what are called transactional emails. A transactional email is a message that is sent to an individual (not part of a mass-mailing), in response to a certain event. This event can be an action taken by some user, and sometimes even a lack of action. Besides the two examples already given, some more examples of transactional emails are:
- An order summary sent to a customer.
- “Jason has commented on your article.”
- A listing of upcoming events for groups a user has subscribed to.
Depending on your site, this type of email can range from something that’s merely “nice to have” all the way to a feature that’s critical for your business.
For emails that are critical (say, a shipping confirmation for an ecommerce site), ensuring delivery of these emails is important. Drupal, by default, will use PHP’s mail function. This is fine for simple applications, but falls short in at least two ways:
- Reputation. Mail you send could be considered spam, and doesn’t reach your users, even though there are no error messages. Some email providers automatically block all email initiated by PHP mail, and sometimes your server’s IP address could be on one or more blacklists. The latter is a problem that can require constant monitoring to ensure it doesn’t affect you.
- Analytics. You get almost no information on who opened your mail, delivery success rate, or clicks on included links. You’re sending mail blind.
Mandrill, a service by Mailchimp, aims to help solve these issues, and with the Mandrill Drupal module, it becomes easy to integrate. After you sign up for a free Mandrill account, create your first API key.
Go to Configuration->Mandrill and enter your new API key.
After entering a valid API key, you’ll be presented with a lot more options, including a “Send Test Mail” tab at the top. You’ll want to send a test email to ensure everything is working properly.
At this point, Drupal is still using PHP mail to send all of its email, so be sure and go to Configuration->Mail System and change Site-wide Default to use the MandrillMailSystem. Its possible to be more granular with what types of emails you actually send through Mandrill, but for now, this setting will get you started, and is fine for most use cases.
Drupal will now use Mandrill to send all of its mail, and you get access to the rich set of reports so you have a better idea of what is going on. That’s all you need to do to ensure more reliable delivery of your site’s mail, with performance analytics.
As a nice bonus, each kind of email that Drupal sends has a unique identifier, and the module automatically tags emails with this identifier before forwarding them to Mandrill for final processing. These tags can be used to filter reports or to perform A/B split tests on your email content to help improve user engagement. Below, you can see how easy it is to target password recovery emails for split testing.
The Mandrill module comes with a sub-module called Mandrill Reporting that gives you some basic reporting from within Drupal itself, but you’ll probably want to stick with the native Mandrill interface so you are sure to get all the details.
Another included submodule is Mandrill Template, which allows different types of emails to each be wrapped in different templates. This is a more advanced use case and requires additional code and knowledge of Mailchimp’s Merge Tags to take full advantage of, but the possibilities are there.
There are similar services that solve the same problems, like Postmark and Sendgrid, and each has their respective Drupal module as well. However, if you are looking for a service that includes a very attractive free tier (12,000 free emails per month!) along with a mature, active, and heavily backed module, Mandrill could be the right choice for you.
Update 7/23/2015: Shortly after publication, Mandrill changed their free tier to just 2000 emails. This is considerably lower than both Postmark, who provides 25,000 free emails, and Sendgrid, who recently added a 12,000 per month free tier. If you like the simplicity of use, feature set, and want to stay in the Mailchimp family, Mandrill is still a good option. Postmark has its own stable Drupal module, but it will cost more over the long run, and if you want to do A/B split testing, you'll probably need the help of another tool.