SASL authentication failed server


After setting up as relayhost for postfix I stumbled into problem when this showed up in /var/log/mail.log

SASL authentication failed; server
Please log in via your web browser and then try again.
Learn more at


Allow access to your Google account via

Gmail SMTP server relay with Postfix in Ubuntu 12.04

Tribut to Diogo Esteves


$ sudo apt-get install postfix libsasl2-2 libsasl2-modules ca-certificates

Edit /etc/postfix/

relayhost = []:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

Create file /etc/postfix/sasl_passwd

$ sudo chmod 400 /etc/postfix/sasl_passwd
$ sudo postmap /etc/postfix/sasl_passwd
$ cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem
$ sudo /etc/init.d/postfix reload