For future reference. This came in very handy after I turned on Google 2-step verification. Originally found here: http://passion4high-tech.blogspot.com/2013/03/postfix-sasl-authentication-failed-with.html

————————————–

If you configure your Google account for extra security to use the 2-step verification, then some applications which work outside the browser might not be compatible with 2-step verification and cannot ask for verification codes.

Postfix which was installed and configured to send out emails won’t work anymore, and you might notice error messages in the /var/log/mail.log file.

Something like:

SASL authentication failed; server smtp.gmail.com said: Application-specific password required.

The solution below should fix this issue: