Using GMail as a relay with Postfix

Fri 22 July 2011

I fiddled a bit with this, so I thought I'd do a no-nonsense guide to doing this. There are other guides, but a lot of them are incomplete and will leave you with queueing issues or annoyances.

The science bit:

smtp_use_tls = yes
# Send all mail through
relayhost =
# Stop getting a catpcha, hopefully.
smtp_destination_rate_delay = 60
relay_destination_rate_delay = 60

Then, edit /etc/postfix/sasl_passwd:

It doesn't have to be an @gmail account, it can be a GAFYD account, once you've logged into it once to activate it.

Then just generate the map file for the sasl_passwd file and reload. As root:

postmap sasl_passwd
postfix reload

And you're done. Monitor your queue a few times over the first few days to make sure stupid stuff hasn't happened (the delay between mails might get tweaked), but in general this has worked for me.

Have fun.

Category: Tech Tagged: imported gmail postfix tech

Page 1 of 1