#Config Postfix Mac OS X Yosemite 10.10
###Step 1. Edit Postfix config file Open a terminal and edit the file main.cf:
sudo vi /etc/postfix/main.cf
First check Postfix is configured correctly, look for the following lines:
mydomain = localhost
mail_owner = _postfix
setgid_group = _postdrop
Now add the following lines at the very end of the file:
#Gmail SMTP
relayhost=smtp.gmail.com:587
# Enable SASL authentication in the Postfix SMTP client.
smtp_sasl_auth_enable=yes
smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options=
# Enable Transport Layer Security (TLS), i.e. SSL.
smtp_use_tls=yes
smtp_tls_security_level=encrypt
tls_random_source=dev:/dev/urandom
smtp_sasl_mechanism_filter = plain
###Step 2. Create the sasl_passwd file We need to create the sasl_passwd file with the SMTP credentials
sudo vi /etc/postfix/sasl_passwd
Write the following content and save:
smtp.gmail.com:587 [email protected]:password
Create the Postfix lookup table from the sasl_passwd file.
sudo postmap /etc/postfix/sasl_passwd
This will create the file sasl_passwd.db
###Step 3. Restart Postfix To apply all new changes we have to restart Postfix:
sudo postfix reload
###Step 4. Test it! Let’s send a mail to our own account to be sure everything is working fine:
date | mail -s testing [email protected]
You can check the mail queue and the posible delivery errors using mailq
mailq