How to setup Gmail SMTP server for OSX Mail with 2-step-verification and App-specific password?

Haven't been able to solve this problem with the threads such as here.

My Gmail stops always working after a while, perhaps after accessing it in different WIFI network or something like this -- it is really driving crazy thing. The Gmail account uses 2-step-verification and app-specific password. I cannot understand this SMTP thing.

How to configure Gmail with App-specific password and 2-step-verification to OSX Mail?

Helper question

  1. how to add the app-specific password to keychain?

  2. app-specific password used in the Internect Access list?

Description and issues

enter image description here

enter image description here


Solution 1:

The SMTP server is used to send mail.

(Note: There are two locations you must paste you app-specific password, these instructions are for the 'sending' server, not the 'receiving' server')

Go to Google and generate an app-specific password on this page.

Now open Mail and go to Preferences > Accounts and select your Google account. At the bottom of the right hand pane it will say "Outgoing Server (SMTP):" and should have "Gmail" selected/ Click on this and you get a pop up menu and select "Edit SMTP Server List".

(This accounts area is where you paste in your 'recieving' password under 'incoming mail server'. Incoming server should be: imap.gmail.com, your username should be the start of your email address without the '@gmail.com' section and your password should be the app-specific password, NOT the account password that was previoulsy used)

This will open a list of the SMTP servers you have set up for sending mail. Click on the "Gmail" one and then click on "Advanced".

Set Authentication to "Password" enter your Google user name then the app-specific password you generated in the password field.

This should now work until you revoke the password.

Solution 2:

The old settings in Keychain can mess up the settings, actually observed earlier by jmegawarne. After I removed the old settings from Keychain, things started to work so clean up the old passwords from Keychain! And remember to input the app-specific password at least two times, not the Gmail password.

Procedure

  1. remove all passwords and usernames from Keychain that are related to the email you are trying to set up

  2. follow the guide by Tony but notice that you need to give the "Application specific password" at least two times so screenshot it or copy it to paper. It is enough to create only one password (misunderstanding in earlier threads).