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.
I've found the answer. I had forgotten that a long time ago I had set 'Reply To' for all email accounts, using a command line in the Terminal.
I reset the defults, by using 'defaults delete com.apple.mail UserHeaders'
All three accounts now work as expected.
Best Answer
If you do have two-step verification enabled you can just go to the App passwords page to generate an app-specific password, although you shouldn't need it on recent versions of iOS / OS X.
If you are sure that two-step verification is turned off I suggest to verify your password. And if you're 100% sure it's correct try changing your password, or if turned off recently turning two-step verification back on.