Pages

Wednesday, April 6, 2011

Configure Ubuntu server to send email through Gmail

Edit the `/etc/postfix/main.cf` file and set the follow values:
smtpd_tls_key_file =
smtp_use_tls = yes
relayhost = [smtp.gmail.com]:587
transport_maps = hash:/etc/postfix/transport
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
Create/edit the `/etc/postfix/transport` file with:
gmail.com smtp:[smtp.gmail.com]:587
Create/edit the `/etc/postfix/sasl_passwd` file with:
[smtp.gmail.com]:587 username@gmail.com:password
Obviously, change the `username` and `password` values.

Note: If you use Google's 2-step verification you should not use your traditional password, but rather visit the https://www.google.com/accounts/b/0/IssuedAuthSubTokens page and generate a new password for postfix.

Finally, issue:



Profit.