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: email can be sent and received without a problem. But then I get this error message:

The SMTP server "smtp.gmail.com" rejected the password for user
"....@gmail.com"

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.

5 Answers
5

The application-password that you create will need to be added in two places in your Apple Mail app.

There is your Incoming Mail Server password, which is immediately visible under your account information.

Below that you can see the selection for Outgoing Mail Server (SMTP). The default will be Gmail. Click on the drop down box and select "Edit Server List".

Here you will discover that you actually need to enter that application-password a second time. Put it in here and you're done.

The other reference to application-passwords expiring is incorrect. ONE-TIME passwords do. If you use the regular application passwords you would log in to your account settings and revoke them when no longer needed.

Thanks. I am aware of this, and I added the password both for both incoming and outgoing mail. I know I added them correctly, because for a while I was able to send and receive emails (I updated the question to reflect this). The problem is that after a while, and without my changing any of the settings, sending email stopped working. I could still receive email. I understand this is a difficult problem to solve; I was just hoping that someone else also ran into it.
–
Guy Gur-AriSep 27 '12 at 15:44

This has been killing me since I went to two factor auth in Gmail...thank you!!
–
cscott530May 12 '13 at 3:40

I ran into this problem as well, and after a while determined it's related to the Keychain Access where the passwords are stored.

One forum I found suggested running a "Repair" of the login keychain (available via the "First Aid" menu item), which resolved the problem for some people. For me, however, the repair process found nothing to fix.

Finally, I went through the following steps which resolved the issue for me:

Soon after you turn on 2-step verification, you'll be alerted that your password is no longer working (see image below). Enter an application-specific password that you generated in the "Password" field (1). If you want Mail to store your password for future sign in, you can click the box next to "Remember this password on my keychain" (2).

I struggled with this problem for a long time before I figured it out.

To access a Gmail account protected by 2-factor verification in Mail, you need to make sure your Google account recognizes your phone as an authorized device. To do this, go to your two-step verification page: