Skip to content

Instantly share code, notes, and snippets.

@yuvadm
Created January 21, 2013 15:30
Show Gist options
  • Save yuvadm/4586857 to your computer and use it in GitHub Desktop.
Save yuvadm/4586857 to your computer and use it in GitHub Desktop.
Configuring Postfix to Work With Gmail on Mac OS X
#### Configuring Postfix to Work With Gmail on Mac OS X
#### Based on: http://blog.y3xz.com/blog/2012/01/11/configuring-postfix-to-work-with-gmail-on-mac-os-x/
# add gmail auth details to relay_password file
sudo echo "smtp.gmail.com:587 [email protected]:your_password" >> /etc/postfix/relay_password
# generate lookup db
sudo postmap /etc/postfix/relay_password
# add relay config
cat >/etc/postfix/main.cf << EOF
relayhost = smtp.gmail.com:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/relay_password
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
smtp_tls_CApath = /etc/postfix/certs
smtp_tls_session_cache_database = btree:/etc/postfix/smtp_scache
smtp_tls_session_cache_timeout = 3600s
smtp_tls_loglevel = 1
EOF
# fetch thawte root ca
sudo mkdir /etc/postfix/certs
sudo wget https://www.thawte.com/roots/thawte_Premium_Server_CA.pem -O /etc/postfix/certs/thawte_Premium_Server_CA.pem
# rehash certs
sudo c_rehash /etc/postfix/certs/
# done! test...
echo "Relay Test" | mail -s "Relay Testing" [email protected]
# optional: define some nice FQDN you own
sudo echo "myhostname = some-domain-i-own.com" >> /etc/postfix/main.cf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment