Forums

GMAIL SMTP Issues

I have a short python script to send out emails (using the Gmail SMTP) - it works on my local machine (on my jupyter notebook) - but I wanted to put it on pythonanywhere and schedule it to run.

I have read this page: https://help.pythonanywhere.com/pages/GmailAppSpecificPasswords/ and other forum posts - but am a little confused - when I first set up my script - the tutorial that I followed said to ensure 2 factor authentication was not turned on - which according to the forum posts - needs to be on to do an app specific password.

Note - using other email services is totally ok with me - I just would like the setup to be clean and not spend $$ on the email service....so if someone really likes a service to use a different one - let me know! I saw mailgun on here but dont know much about it....

Traceback (most recent call last): File "/home/**/email_script.py", line 7, in <module> server.login('*@gmail.com','**') File "/usr/lib/python3.7/smtplib.py", line 730, in login raise last_exception File "/usr/lib/python3.7/smtplib.py", line 721, in login initial_response_ok=initial_response_ok) File "/usr/lib/python3.7/smtplib.py", line 642, in auth raise SMTPAuthenticationError(code, resp) smtplib.SMTPAuthenticationError: (534, b'5.7.14 https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbu\n5.7.14 wzyRUzlK8ZlVvJzWsHCOnc--fwx3KVxtqMSWXpBbdudeOxtWrkaC_ZnImpyY_CgAUplTH\n5.7.14 wAbdyO7reB0X-0i4LM50JUbogrsLf7Sfmj1CJoouDTqp2cBzSZntLKuQexy17J4L\n5.7.14 Please log in via your web browser and then try again.\n5.7.14 Learn more at\n5.7.14 https://support.google.com/mail/answer/78754 i21sm559973qtr.94 - gsmtp')

Google says "App Passwords can only be used with accounts that have 2-Step Verification turned on." so it looks like you need it.

Thank you! I am going to see if I can get Mailgun working....assuming that is a better long term solution anyhow

Sure, fair enough.