If you’re like me and you do your development work on a Mac, you’ll want to configure Postfix to send you email messages.
It’s pretty easy to do.
Edit main.cf and add the following to the end of the file.
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 smtp_tls_security_level=encrypt tls_random_source=dev:/dev/urandom
The key one is the smtp_sasl_password_maps. That’s where you’re going to configure smtp.gmail.com.
Edit sasl_password, it probably doesn’t already exist. Add this to it.
You’ll want to change, “mysweatyballs” to “yoursweatyballs” or whatever your gmail.com email address is. Don’t enter your gmail password in this file. It won’t work because you’ve enable 2-factor authentication. If you’re not using 2-factor authentication to gmail, enable that now.
You need to generate an application password for postfix running on your mac. Go to google, login and visit https://myaccount.google.com/security. Look for App Password, click and “Generate” a new application password. Select Other (custom name) and enter a name like “My Dev Box Postfix” and click the “Generate” button.
Then run this on your Mac.
That’s it, all your email is now getting delivered via gmail’s smtp server. There’s a daily limit on how many emails you can send, I think it’s one hundred.