SMTPAuthenticationError when sending mail using gmail and python [duplicate]

Your code looks correct. Try logging in through your browser and if you are able to access your account come back and try your code again.
Just make sure that you have typed your username and password correct

EDIT:
Google blocks sign-in attempts from apps which do not use modern security standards (mentioned on their support page). You can however, turn on/off this safety feature by going to the link below:

Go to this link and select Turn On
https://www.google.com/settings/security/lesssecureapps

Leave a Comment