Aug-21-2018, 07:22 AM
Hello,
I am trying to just learn how to send e-mails with python. I have found some code online and I am trying to use it but an error keeps appearing. This is the code I am trying to use.
Thanks :)
I am trying to just learn how to send e-mails with python. I have found some code online and I am trying to use it but an error keeps appearing. This is the code I am trying to use.
import smtplib server = smtplib.SMTP_SSL('smtp.gmail.com', 465) server.login("my_email", "my_password") server.sendmail( "from_email", "to_email", "Test Message") server.quit()When I do this, this is what happens:
Output:Traceback (most recent call last):
File "C:\Users\keega\OneDrive\Documents\Python\Email Sender.py", line 4, in <module>
server.login("k*************[email protected]", "K*****123")
File "C:\Users\keega\AppData\Local\Programs\Python\Python36-32\lib\smtplib.py", line 730, in login
raise last_exception
File "C:\Users\keega\AppData\Local\Programs\Python\Python36-32\lib\smtplib.py", line 721, in login
initial_response_ok=initial_response_ok)
File "C:\Users\keega\AppData\Local\Programs\Python\Python36-32\lib\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=AKgnsbua\n5.7.14 BWQcAmZiJozJSC9UqHf-MDmwIwlPfsh2QD_0n8TN8Lwr1Jx6EXt33UVEyOBgAXJHTNvnXX\n5.7.14 Y3yIr1HUR877awIHRkPYpljnbMIt6UpOK66N7MISLFL_qG-BHQNqFXGMcT23yQbMVDiugI\n5.7.14 yeBgR7_P84SEH-8MFZjQ38inz0tIJP8S1dB7yr2_4K6n-ONQdtxEGYV71D_FEyRzCzfNyL\n5.7.14 5l6psrK-kOCcl03uzz5HlxUWnjo80nJA_VXUCaCiBsuJLuRBjp> Please log in via\n5.7.14 your web browser and then try again.\n5.7.14 Learn more at\n5.7.14 https://support.google.com/mail/answer/78754 c68-v6sm18546669pfj.51 - gsmtp')
Does anyone know what is wrong and how to fix it?Thanks :)