How to implement Mandrill with Exim on cPanel

How to implement Mandrill with Exim on cPanel

Mandrill

Mandrill is a transactional email service run by MailChimp, comparable to SendGrid. It comes stock with a powerful API for fast implementation into applications for sending email reliably over SMTP, but it can also be used as a smart host for all of your server’s outgoing email.

The below instructions cover how to do this via command line. If you prefer WHM, simply go to WHM >> Exim Configuration Manager >> Advanced Editor and alter the sections indicated.

First, open up your /etc/exim.conf.local file in an editor and look for the @AUTH@ section.

Perform modification as following

@AUTH@
auth_login:
driver = plaintext
public_name = LOGIN
hide client_send = : your@email : api_key


Note: If exim.conf.local doesn’t exist, then we have to create it.

The value of api_key is not your Mandrill account password – it’s your API key. You can find it in your account settings under “SMTP & API Credentials”

Also, replace your@email with your Mandrill account email address. If you already have something in the AUTH section, simply add this block of text below it.

Now look for the @PREROUTERS@ section, and modify it to look like this:

@PREROUTERS@
smart_route:
driver = manualroute
domains = ! +local_domains
ignore_target_hosts = 127.0.0.0/8
transport = auth_relay
route_list = * smtp.mandrillapp.com
no_more


The last modification should be to the @TRANSPORTSTART@ section:

@TRANSPORTSTART@
auth_relay:
driver = smtp
port = 587
hosts_require_auth = $host_address
hosts_require_tls = $host_address


Save this file. Now open /etc/exim.conf.localopts and add this statement:

smarthost_routelist=*: smtp.mandrillapp.com

If you’re using WHM, this is under Basic Editor >> Mail >> Smarthost Support.

Save the file, and apply the changes:

/scripts/buildeximconf

service exim restart


To test whether things are working, send an email out from your server, and look for it in /var/log/exim_mainlog. You should see something like this in your log entry:

2016-01-12 21:59:50 1WNbGg-0006ud-2d => to@email R=smart_route T=auth_relay H=smtp.us-east-1.mandrillapp.com [x.x.x.x] X=UNKNOWN:ECDHE-RSA-AES256-GCM-SHA384:256 A=auth_login C="250 2.0.0 Ok: queued as 3529E193E178"

If you have SPF records, have to add the hostname of the SMTP server to the record itself to allow the third-party mail server to send email on behalf of your domain. Mandrill will provide the hostname you should use under Settings -> Sending Domains, when you do an SPF test.
Author
bhawanisingh
Views
2,105
First release
Last update
Rating
0.00 star(s) 0 ratings
Top