PostFix with Gmail on CentOS
Here's how I setup a postfix relay using Gmail on CentOS 6.3 Minimal
Started off by following the directions here:
http://charlesauer.net/tutorials/centos/postfix-as-gmail-relay-centos.php
Initially, it did not work. I saw these errors in /var/log/maillog
warning: SASL authentication failure: No worthy mechs found
03DD726033A: SASL authentication failed; cannot authenticate to server smtp.gmail.com[74.125.25.109]: no mechanism available
warning: SASL authentication failure: No worthy mechs found
to=<xxxxxx@yahoo.com>, relay=smtp.gmail.com[74.125.25.108]:587, delay=145, delays=144/0.14/0.73/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server smtp.gmail.com[74.125.25.108]: no mechanism available)
Typically, these errors arise when the remote server only offers plaintext authentication mechanisms. To check this I turned on postfix debugging by adding the following lines to main.cf. Don't forget to restart Postfix after these changes.
debug_peer_list=smtp.gmail.com
debug_peer_level=3
With the debugging now turned on, I attempted another email and I saw this:
smtp_sasl_authenticate: smtp.gmail.com[74.125.25.108]:587: SASL mechanisms LOGIN PLAIN XOAUTH XOAUTH2
That told me that Gmail was in fact accepting encrypted authentication mechanisms. Word to the wise, unless you are developing code, you probably don't need to turn the debug level up higher than three on postfix.
The solution to my problem was at http://www.postfix.org/SASL_README.html all along.
Postfix logs the following message:
SASL authentication failure: No worthy mechs found
When the libplain.so or liblogin.so modules are not installed in the /usr/lib/sasl2 directory.
yum install cyrus-sasl-plain
Conclusion
Simply installing postfix is not enough when you want to use SASL to relay mail through another server. You must also be sure to install the additional SASL modules.