I had the same problem. I guess it's a gmail ban, because the Gmail send a mail with this link: https://support.google.com/mail/answer/14257?p=client_login&rd=1
The point is this: https://www.google.com/settings/security/lesssecureapps
You should change the "Access for less secure apps" to Enabled (it was enabled, I changed to disabled and than back to enabled). After a while I could send email.
Hey guys, just found what's going on with those errors.
The problem is that when you have activated the Google Authenticator Verification you also need to set up the 2-Step-Authentication in your gmail account.
Therefore visit https://www.google.com/settings/security - when you have done so, just go back to this page and click the "App Password" - Settings.
Select "Other (custom name)" and enter any name you like. Go ahead and copy the code and paste it to your projects settings.
Done! - This resolved all issues for me.
Same problem here.
localhost --> can send mails
upload applicaton to droplet --> can not send mails
I too ran into this problem today. I confirmed through my /var/log/mail.log that the connection happens, the username and password are sent (correct credentials), but the response is always:
535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 http://support.google.com/mail/bin/answer.py?answer=14257 u8sm6322553qat.27 - gsmtp
I tried with an account that is in use in a different environment as well as with a brand new account within my google apps domain. Neither account worked.
Your solution was accurate and it worked for me as well. Infact, this 2 step authentication is great because now you can have different passwords for different devices.
I have the same problem. I fallowed your instructions. This works good on my local host. But when i use same on my live it give me error "535 Incorrect authentication data". I believe that it is due to location of my live server. But what will be the solution for this?
Thanks in advance,
For me the problem was not auth but the mail with valid URL inside.
I removed the urls and everything is fine.
There's some changes from google security on Google Apps or gmail accounts.
To avoid the issue i had solved with the following steps:
1.Login into your account Gmail or Google Apps then goto:
and Turns On the Access for less secure apps.