I set up postfix email server on my Mac mini some time ago but I recently wiped & reinstalled El Capitan (OS X 10.11.1) on that machine when I replaced the HDD with a SSD, so here’s how I did it. I’ve italicised where you need to enter your own specific info. The main sources for my info were:
- Using MacOSX Lion command line mail with Gmail as SMTP
- Send Email on OS X Lion through GMail
- relay server requires authentication
- How to generate an App password
- Rogers email settings
Note: this configuration has evolved over a few years, so there may be some redundant settings.
- Append to /etc/postfix/main.cf
relayhost = [smtp.gmail.com]:587
myhostname = $HOSTNAME
mydomain = yourDomainName
myorigin = $mydomain
smtp_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_tls_note_starttls_offer = yes
smtp_tls_security_level=encrypt
smtp_tls_CApath = /etc/certificates
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_sasl_tls_security_options = noanonymous - vi /etc/postfix/smtp_tls_sites
smtp.broadband.rogers.com MAY - vi /etc/postfix/tls_policy
[smtp.gmail.com]:587 encrypt - vi /etc/postfix/sasl_passwd
[smtp.gmail.com]:587 yourEmailAddress@gmail.com:googleAppPassword - chmod 600 /etc/postfix/sasl_passwd
- postmap /etc/postfix/sasl_passwd
- postmap /etc/postfix/smtp_tls_sites
- % sudo openssl s_client -starttls smtp -crlf -connect smtp.broadband.rogers.com:587 -showcerts < /dev/null | sed -n '/-BEGIN /,/-END /p' | sudo sh -c 'cat > /etc/certificates/relayhost.pem’
- % sudo postfix start
- % date | mail yourEmailAddress
- % mailq
One problem I haven’t yet resolved is having postfix start automatically after booting OS X. I had this working with previous versions of OS X but El Capitan introduced System Integrity Protection which means I can’t easily update the postfix property list (plist) in /System/Library/LaunchDaemons.
This might help with the plist update problem – https://apple.stackexchange.com/questions/214917/editing-the-system-library-launchdaemons-com-apple-pfctl-plist-file
That worked! 🙂