Improve Drupal email delivery rates by using Mandrill
Recently one of my clients had a problem with a large portion of transactional email never being seen. The emails were being directed to the recipients' spam folders and were generally being over-looked. These were important emails regarding things like membership confirmations, invoices and event information and were critical to the experience of the members.
Why was this happening? Mostly because the emails were being sent by the web server. I switched it to a Mandrill, a service designed to take care of the headaches of sending transactional email, and this greatly improve the delivery rate.
It is notoriously difficult to ensure emails from your application (such as Drupal) actually get delivered without getting caught in spam filters. Email providers like Mandrill have the expertise to maximise delivery rate. You are unlikely to have the time or expertise to manage this process for your own web server.
Mandrill provides great stats so that you can gain a greater understanding of email delivery, if it is getting caught by spam filters, bounces, open rates etc. You can also test different versions of the same email to see which one performs best in terms of open rates.
Difference between Mandrill and MailChimp
It is easy to get confused between services like Mandrill and services like MailChimp. Mandrill is actually owned by MailChimp and uses the same delivery infrastructure, but the two services have very different purposes. As mentioned, Mandrill is intended for transactional email like confirmation emails, password resets, invoices sent by email. Services like MailChimp are intended to manage email lists for things like newsletters and drip email campaigns.
Setting up Mandrill
Mandrill is relatively simple to install and setup on a Drupal site.
The requirements are:
- Mandrill module
- Mandrill library
- Mail System module
- Mandrill account
After installing, go to Configuration > Web services > Mandrill.
Add your Mandrill API Key (which you need to get from your Mandrill account)
To switch email to use Mandrill, you need to configure Mail System Settings. Go to Configuration > System > Mail System. Here you will see all of the mail classes available and you can switch them to MandrillMailSystem.
In my case, with the client project, a lot of the transactional emails were a result of a customer buying a product with Ubercart. The emails were triggered using Drupal Rules.
Mandrill Test Module
While testing, you can enable the Mandrill Test module. When an email is sent, the subject will be replaced with "Altered test subject" and the body will be replaced with "Altered mail content". Just don't enable this on the production site!
Sending a test email
You can send a quick test email from Configuration > System > Services > Mandrill. You can send the test email to any email address and this will be sent via Mandrill.
Mandrill is very competitive price-wise. The first 12,000 emails are free. After that, they are $0.20 per 1000 emails. That is not per email, but per 1000 emails! So if you send 13,000 emails, the total cost is $0.20. You can send 17,000 emails for $1.
Most Drupal websites will need to send some form of email. The last thing you want is to have these emails unnecessarily caught by spam folders. Fortunately this is a problem that is relatively easy to fix with a service like Mandrill and very cost efficient.
Note: I am no way affiliated with Mandrill or MailChimp!
New comments for this tutorial have been turned off.