-
Create a new app password in Gmail for Postfix (Optional - this is required only if you have 2-Step Verification enabled.)
-
Edit
/etc/postfix/sasl_passwd
with your username and app password:smtp.gmail.com:587 yourname@gmail.com:CHANGEME
Restrict permissions while we're here:
sudo chmod 640 /etc/postfix/sasl_passwd
-
Update mapping:
sudo postmap /etc/postfix/sasl_passwd
-
Backup Postfix
main.cf
and reconfigure:sudo cp /etc/postfix/main.cf /etc/postfix/main.cf.bak sudo postconf \ compatibility_level=2 \ inet_protocols=ipv4 \ relayhost=smtp.gmail.com:587 \ smtp_sasl_auth_enable=yes \ smtp_sasl_mechanism_filter=plain \ smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd \ smtp_sasl_security_options=noanonymous \ smtp_tls_CAfile=/etc/ssl/cert.pem \ smtp_tls_loglevel=1 \ smtp_tls_security_level=verify \ smtp_use_tls=yes sudo postfix reload
You may get a warning about Postfix not running. If you want to interact with port 25 directly, also do
sudo postfix start
or edit launchd scripts to always have it running. Else, it will be started upon use of system tools like mail(1) - TODO: verify and add how-to. -
Stream logs while testing
date | mail yourname@gmail.com
:log stream --predicate '(process == "smtpd") || (process == "smtp")' --info
In another window:
date | mail yourname@gmail.com
-
Todo
Last active
October 3, 2017 15:53
-
-
Save talarczykco/4e3cc04cd3b1a807d3d2f45c75bbface to your computer and use it in GitHub Desktop.
How to get Postfix sending mail from my MacBook
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment