Forums

Trouble with Gmail SMTP

Hello everyone! I'm free user. I trying to send email via python script. I'm using that settings:

SERVER = "smtp.gmail.com"
USER = "my_username@gmail.com"
PASSWORD = 'my 16-digit app-specific password'

When I run script from my computer, all working is excellent and without any errors. When I try to run script through pythonanywhere I see that error:

smtplib.SMTPAuthenticationError: (535, '5.7.8 Username and Password not accepted. Learn more at\n5.7.8  https://support.google.com/mail/?p=BadCredentials u4-20020a05622a198400b00398ed306034sm4756843qtc.81 - gsmtp')

Can you help me to solve that problem? Thanks in advance.

Take a look at https://help.pythonanywhere.com/pages/SMTPForFreeUsers/ and maybe https://help.pythonanywhere.com/pages/GmailAppSpecificPasswords