Tuesday, December 25, 2018

Getting error to email through python script

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

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...