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.
Prerequisites
- 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 -fIt 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_passwdChange the username and api key with yours.
[smtp.mandrillapp.com]:587 your_mandrill_username:your_mandrill_api_keyAnytime you change the credentials, you need to run postmap
$ sudo postmap /etc/postfix/sasl_passwdChange Postfix Setting
The settings will be quite different. Type below to open postfix setting file.
$ sudo vi /etc/postfix/main.cfAnd 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=yesSave and then don't forget to reload postfix
$ sudo postfix reloadTesting
Here is the command you need to execute to test postfix. Please change your_email and your_domain with yours.
$ echo "Test sending email from Postfix Mandrill" | mail -s "Test Postfix Mandrill" your\_email@your\_domain.comIf success, you will receive test email in your inbox.
Conclusion
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.

