How to Configure Mac Postfix to Use Gmail for SMTP Relay

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.

vi /etc/postfix/

Edit and add the following to the end of the file.

The key one is the smtp_sasl_password_maps. That’s where you’re going to configure

vi /etc/postfix/sasl_passwd

Edit sasl_password, it probably doesn’t already exist. Add this to it.

You’ll want to change, “mysweatyballs” to “yoursweatyballs” or whatever your 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 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.

postmap /etc/postfix/sasl_passwd

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.

Share Button