I am using the Mail app on Mac OS X to access my Gmail account using 2-factor authentication. The app is configured with an application-specific password and it works fine for a few days. But then I get this error message:

> The SMTP server "smtp.gmail.com" rejected the password for user
> "[email protected]"

From this point on no emails can be sent, although I still get incoming messages via IMAP.

If I revoke the app-specific password, generate a new one, and enter it in the app, it fixes the problem for a few days. Then I get this error again and must enter a new password. This has been going on for months.

Before I turned on 2-factor authentication, everything worked smoothly.

I also have Gmail configured on my iPhone with a different app-specific password, and there this problem does not occur.