If sending mail via your localhost is unreliable or not working, try setting up postfix to use an SMTP account through Mandrill.  You can essentially use any SMTP account, but Mandrill has nice features that allow better monitoring of messages and if they are being delivered.

Edit the postfix config file.

$ sudo vi /etc/postfix/main.cf

Add the following settings to the very bottom of the main.cf file.

# Mandrill SMTP
relayhost = [smtp.mandrillapp.com]:587
# Enable SASL Authentication
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter = plain
# Enable TLS (SSL)
smtp_use_tls = yes

Verify the following three variables are set correctly in the main.cf file (these may appear anywhere in your file).

mydomain_fallback = localhost
mail_owner = _postfix
setgid_group = _postdrop

Set SASL login credentials by editing the password file.

$ sudo vi /etc/postfix/sasl_passwd

Enter your host, username, and password in the following format.

[smtp.mandrillapp.com]:587 your_mandrill_username@example.com:y0Ur_passw0rD

Create the postfix lookup table from the sasl_passwd file. This will generate the file sasl_passwd.db. Note that anytime you edit the sasl_passwd file you will need to run this command.

$ sudo postmap hash:/etc/postfix/sasl_passwd

Restart postfix.

$ sudo postfix reload

Send a Test Message

$ date | mail -s testing you@example.com

Additional Commands

You may need to run these to check on the status of postfix.

$ sudo postfix status         # check if postfix is running
$ sudo postfix start          # start postfix
$ mailq                       # check mail queue
$ sudo postfix flush          # force mail in queue to send
$ tail -f /var/log/mail.log   # monitor mail logs
0 0 votes
Article Rating
in Mac OSX
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments