I am trying to sign in into my Gmail
to send emails from Python
, exactly from SMTPlib
library.
I checked some answers here and most of them mention that I should allow Less secure apps
, I did that already, I also have 2-Step Authentication
turned off.
Here is exactly what I tried :
import smtplib, ssl
from email.message import EmailMessage
my_email = "xxxxx@gmail.com"
my_password = "Mypasswrd"
other_email = "xxxxx@gmail.com"
email = EmailMessage()
email['from'] = my_email
email['to'] = other_email
email['subject'] = 'Test'
email.set_content('Just testing')
smtp = smtplib.SMTP(host='smtp.gmail.com',port=587)
smtp.ehlo()
smtp.starttls()
smtp.login(my_email,my_password)
And here is the error message I keep getting:
smtplib.SMTPAuthenticationError: (534, b'5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbv\n5.7.14 MKRQdTnq4XnXPAPVi9BKgDrbJ-EarzJPoivk3G1WLburL60D14QnkyWEy78Xj_kvdgcuQ\n5.7.14 ATCC_NvPh1JEpdKSCWlfKMdiP6ZvqsoqCVeQXpRQMqpq_Js25fKsdnZG_0A8sLLL>\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 21sm9494384wme.6 - gsmtp')
Any help please?
Thanks.