MODX Developers Tutorial – Improving Email Deliverability

11th March 2015

assets/uploads/mandrillandmodx.jpg

By default, MODX will use the SMTP service on your web server to send emails, normally using PHP Mailer. This normally works fine, but there are a number of points of failure with this method; the SMTP service could crash, a mailbox could be temporarily out of action and there could be a number of spam complaints against your site's IP address, especially if you're on shared hosting. Luckily there's a free and easy to use solution that gives you much higher deliverability (we're currently on 99.7%), as well as open and link tracking analytics.

Here at Studio Republic, our MODX developers integrate Mailchimp's email delivery system, Mandrill with our MODX installations to give us all those benefits. It's an easy change to implement, but as far as we can find there's no documentation online to walk you through the process, so that's what we're going to do here. Mandrill will also take over all automated MODX email delivery, so Formit emails, user account emails, Quip notifications and more will all go through Mandrill.

Signing up with Mandrill

First thing's first, you'll need to get yourself a Mandrill account. It's completely free for up to 12,000 emails per month, and you can sign up at www.mandrillapp.com. Once you've got your account sorted, go into Settings > SMTP and API Info. Here you'll find the SMTP details for your account, and you can generate new API Keys on a per client basis.

To generate a new key simply click the + New API Key button, fill in the description (we just use the client's name), and click Create API Key. That's it! You should now see your new key in the list below the New API Key button.

Setting up MODX

Once that's done and you've got your API key, jump into your MODX manager and go into System Settings.

The MODX system settings screen

The first thing to do is use to 'Filter by area...' drop down menu and select Mail. This will give you access to everything you're going to need to change to get you up and running using Mandrill with MODX.

There's only a few things you'll need to change in these settings:

  • SMTP Authentication – Set this to yes.
  • SMTP Hosts – Add 'smtp.mandrillapp.com' to this field
  • SMTP Password – This is the API key you generate at mandrillapp.com
  • SMTP User – The username of the Mandrill account

That's all you need to change! Confirm all the changes have gone through OK by sending any email out through your contact form, or whatever you're using emails for, and check your dashboard in Mandrill to track the email.

Studio Republic are proud to be experienced MODX developers and we hope you found this article useful. Check back soon for more web tutorials and for MODX updates, why not check out their blog at modx.com/blog

If there's anything you'd like to hear about, get in touch with us on Twitter @studiorepublic, or email us at info@studiorepublic.com.