A little bit of everything

Setup Unix SMTP postfix mail on OSX

Configure Postfix for Gmail SMTP on OSX

vi /etc/postfix/main.cf
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter = plain
smtp_use_tls = yes

Generate sasl_password

vi /etc/postfix/sasl_passwd

[smtp.gmail.com]:587 username@gmail.com:password

Run the following

sudo chmod 600 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd
sudo launchctl stop org.postfix.master
sudo launchctl start org.postfix.master

Thats it you should not be able to send mail from the command line

date | mail -s “Test” me@mail.com

Note:

In December 2014 my postfix configuration broke. I think it was a result of a OS X upgrade of the Command Line Tools for OS X 10.10 to version 6.1. I added the line “
smtp_sasl_mechanism_filter = plain” to the above configuration and things started working again.

blog comments powered by Disqus