1. What is Mandrill?
Mandrill is an SMTP relay service which is very reliable and fast.
It allows anyone to send emails through their SMTP API so that you don’t have to send through your own server and as a result not exhaust your local mail server or it’s limits.
It also increases deliverability by ensuring clean, reputable, non-blacklisted email IPs at all times.
2. Setting up Mandrill with the Newsletter plugin
2.1. Verify Sending Domain
First go to Mandrillapp.com and login or sign up.
Once you are logged in, go to Settings > Domains > Sending Domains. Let’s assume that you don’t have any sending domains setup yet, then you can fill in your domain name into the field and click “Add” to add your domain that you’ll be sending from.
2.2. Get SMTP Credentials
You can now get your SMTP credentials from Mandrill to fill into the Newsletter plugin in order to start sending.
In your Mandrill dashboard still, go to Settings > SMTP & API Info.
You’ll see a host, port and SMTP username there that you will use in the next step so copy them or remember them.
The SMTP Password will just say “Any valid API key” so you’ll need to go down a bit and use one of the existing API keys there or if there aren’t any API keys yet, you can click “Add API Key” to generate one.
2.3. Insert the Newsletter plugin’s Settings
In your WordPress dashboard, go to Newsletters > Configuration > General > General Mail settings.
For the “Mail Type” setting, you’ll select “SMTP Server” since you’re going to be using Mandrill’s SMTP server. Then fill in the host, port and SMTP username from the previous step that Mandrill provided to you. For the SMTP password, you’ll fill in any API key that you generated there.
Mandrill supports TLS and SSL for the protocol so the choice is yours.
3. Mandrill Bounce
The WordPress Newsletter plugin has Mandrill bounce management built into it using a Mandrill webhook to automate the process for you. So the subscribers will automatically be updated with bounces as Mandrill identifies bounces/complaints on their side and notifies the webhook.
3.1. Turn on Mandrill Bounce
The first step is to go to Newsletters > Configuration > General > Bounce Configuration in the WordPress Newsletter plugin and set the “Bounce Handling Method” to “Mandrill Webhook“.
You’ll see that it provides you with quick instructions and a URL that you need to use for the Mandrill webhook in order for the bounces/complaints to work. Copy this URL to your clipboard as you’ll need it in the next step.
3.2. Create a Mandrill Webhook
Go to your Mandrill dashboard and navigate to Settings > Webhooks and click “Add a new webhook“.
Choose the following options by ticking the checkboxes:
- Message is bounced
- Message is soft-bounced
- Message is rejected
- Message is spam
Then fill in the URL which you copied from the WordPress Newsletter plugin configuration in the previous step. Then also fill in a description for this. Something such as “Newsletters Bounce“. And then click “Create Webhook” and you’re done.
Your Mandrill bounces, rejections, complaints, etc will now be automated through the Newsletter plugin.
4. Troubleshooting Mandrill SMTP
Sometimes the settings may not work in the Newsletter plugin.
The main reason for this in most cases is restrictions on the hosting by the hosting provider. We have seen this day in and day out where a certain protocol like TLS/SSL are blocked or that specific ports eg. 587 is blocked for outgoing connections or in some cases PHP socket connections using fsockopen() is completely disabled or partially restricted. Most of these things are for security purposes.
If you are unable to send with Mandrill and you get a connection timeout error or maybe a “Called Mail() without being connected” error it most likely means that the outgoing PHP socket connection to Mandrill’s SMTP server is being blocked by the hosting.
Simply email/phone your hosting provider and tell them Mandrill’s host, port and protocol and tell them that you are trying to make an outgoing PHP socket connection to that and would they please tell you if it is restricted and if it is if they can either unblock it or give you an alternative port to connect on.