Error sending email: raise SMTPAuthenticationError(code, resp)
Go to Google's Account Security Settings: www.google.com/settings/security
Find the field "Access for less secure apps". Set it to "Allowed".
Try your script again, changing server.sendemail()
to server.sendmail()