I am very new to python. I was trying to send a mail using a python script. But getting the below mentioned error:
$ python main.py
Traceback (most recent call last):
File "main.py", line 8, in
server.login("rake.son25@gmail.com", "*********")
File "C:\Python27\lib\smtplib.py", line 622, in login
raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (534, '5.7.14 Please log in via your web browser and\n5.7.14 then try again.\n5.7.14 Learn more at\n5.7.14 https://support.google.com/mail/answer/78754 fj19sm61312778pab.37 - gsmtp')
But I mentioned the correct pw and email in the script.
main.py:
import smtplib
msg = "YOUR MESSAGE!"
server = smtplib.SMTP('smtp.googlemail.com')
server.ehlo()
server.starttls()
server.login("rake.son25@gmail.com", "mypassword")
server.sendmail("rake.son25@gmail.com", "rakeshlochansarma25@gmail.com",msg)
server.quit()
No comments:
Post a Comment