I found that the problem with many gmail installations in Apple Mail (and other mail clients) is related to Google's two step verification process. If you remember getting text codes on your mobile device(s) asking you to verify your email account, this is a possibility for you. You may have to log onto GMail from your browser, got to the "gear" icon->settings->Change account settings->Change password recovery options, then put in your password again at the resulting verification window, and turn off secondary verification via text in the ensuing windows. This prevents the mail client from failing to verify via a password you may not even have access to in order to go online. Once you have done this and saved it, you should be able to send and receive mail and no longer be prompted for your password unsuccessfully over and over. MAke sure, of course, that all your regular email settings are correct again (like FULL email address in user name fields), now that you may have changed lots of things in the vain attempt to overcome this rather obscure problem
P.S., it's a Google issue, not an Apple issue. It seems Apple and Apple Mail hs been getting a bit of a bad rap here for being asked to do the impossible based on what it has been given to work with.
Just another day in paradise!
Bilzi Mac Services
After suffering for 24 hours, finally I followed all support instructions but before being successful to activate my Gmail account with Mail, I followed following steps:
1. Signed in to my Gmail account from browser;
2. Turned off from "2-Step Verification" prcess;
3. Re-established my gmail account in Mail using port 465 (by clicking on use Custom Port)
4. Voila, I got my IMAP set and is working fine.
Hope this help others woth similar problem with GMail in Mail. Later I will try again by "Turning On "2-Step Verification" process in my Gmail account using a browser and will let you know the outcome.