Mail.app rejecting correct password for gmail accounts

gmailmail.apppassword

Mail.app has stopped accessing several of my gmail accounts. It gives the generic error "Mail can't connect to the account "xxxx". Enter the password for user "myusernamehere". When I enter the correct password, it circles back to this error. Going directly to gmail, I can login with that same password.

One of the two accounts with this problem is a new one I was setting up, but the other is my "main" account which has been in use with mail.app for years.

Best Answer

The fix is to login to the google account affected, and then go to https://www.google.com/settings/security/lesssecureapps and select "Enable" for the question "Access for less secure apps."

Apparently this results from a change Google made several months ago to improve security, which is indeed becoming more and more important as Google accounts are tied to a wider and wider range of uses. It is a mystery to me why it suddenly prevented my logging in now, but I wanted to share the solution I found in case anyone else encounters the same problem.