Skip to content


How to relay mail from an ubuntu server running postfix to gmail servers

Edit /etc/postfix/main.cf with the following

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = secure
smtp_tls_mandatory_protocols = TLSv1
smtp_tls_mandatory_ciphers = high
smtp_tls_secure_cert_match = nexthop
smtp_tls_CApath = /etc/ssl/certs
relayhost = smtp.gmail.com:587

echo “smtp.gmail.com:587 smtp_user:smtp_passwd” > /etc/postfix/sasl_passwd
postmap hash:/etc/postfix/sasl_passwd
service postfix restart
echo “Test mail from postfix” | mail -s “Test Postfix” you@example.com

Posted in General.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

You must be logged in to post a comment.