In my previous post, I talked about how to install postfix mail server on mac OSX. At that time, I used Gmail SMTP for sending the emails. This article will show you how to configure Mandrill SMTP for postfix.
- You already have postfix installed and configured like in this post.
- You have Mandrill account and created the Mandrill SMTP credentials.
Ensure the Hostname is FQDN
I think this is important for Mandrill app to work. You need your hostname has FQDN format. Try to type
$ hostname -f
It must be like this
domain.tld. FYI, mine is
Budis-MacBook-Air.local. I thought It wouldn’t work using .local but Mandrill still accepts it.
Change Postfix Credentials
Go to terminal and type
$ sudo vim /etc/postfix/sasl_passwd
api key with yours.
Anytime you change the credentials, you need to run
$ sudo postmap /etc/postfix/sasl_passwd
Change Postfix Setting
The settings will be quite different. Type below to open postfix setting file.
$ sudo vi /etc/postfix/main.cf
And make some changes like following.
relayhost= [smtp.mandrillapp.com]:587 smtp_sasl_auth_enable=yes smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd smtp_sasl_security_options= noanonymous smtp_use_tls=yes
Save and then don’t forget to reload postfix
$ sudo postfix reload
Here is the command you need to execute to test postfix. Please change
your_domain with yours.
$ echo "Test sending email from Postfix Mandrill" | mail -s "Test Postfix Mandrill" your_email@your_domain.com
If success, you will receive test email in your inbox.
In article, we use Mandrill SMTP for Postfix. The configuration is not much difference with Gmail SMTP but Mandril offers more email that can be sent every month than Gmail.