I ran into a similar problem and came across this question. I received an SMTP authentication error, but my username / password was correct. Here is what it fixed. I read this:
https://support.google.com/accounts/answer/6010255
In short, Google does not allow you to log in via smtplib because it has marked this type of login as "less secure", so you need to follow this link when you log in to your Google account and allow access:
https://www.google.com/settings/security/lesssecureapps
Once this is installed (see my screenshot below), it should work.

Login now works:
smtpserver = smtplib.SMTP("smtp.gmail.com", 587) smtpserver.ehlo() smtpserver.starttls() smtpserver.ehlo() smtpserver.login(' me@gmail.com ', 'me_pass')
Answer after change:
(235, '2.7.0 Accepted')
Previous answer:
smtplib.SMTPAuthenticationError: (535, '5.7.8 Username and Password not accepted. Learn more at\n5.7.8 http://support.google.com/mail/bin/answer.py?answer=14257 g66sm2224117qgf.37 - gsmtp')
Still not working? If you still get SMTPAuthenticationError, but now the code is 534, this is because the location is unknown. Follow this link:
https://accounts.google.com/DisplayUnlockCaptcha
Click Continue and this should give you 10 minutes to register your new application. So go on to the next login attempt, and it should work.
It doesn't seem to work right away, you can get stuck with this error in smptlib for a smptlib :
235 == 'Authentication successful' 503 == 'Error: already authenticated'
The message says that you must use a browser to log in:
SMTPAuthenticationError: (534, '5.7.9 Please log in with your web browser and then try again. Learn more at\n5.7.9 https://support.google.com/mail/bin/answer.py?answer=78754 qo11sm4014232igb.17 - gsmtp')
After enabling "lesssecureapps", try the coffee, go back and try the "DisplayUnlockCaptcha" link again. From user experience, it may take up to an hour for the change to take effect. Then try logging in again.
UPDATE :: See my answer here: How do I send an email from Gmail as a provider using Python?