Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sending E-mails
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('', 465)
server.login("my_email", "my_password")
  "Test Message")
When I do this, this is what happens:
Traceback (most recent call last): File "C:\Users\keega\OneDrive\Documents\Python\Email", line 4, in <module> server.login("k*************[email protected]", "K*****123") File "C:\Users\keega\AppData\Local\Programs\Python\Python36-32\lib\", line 730, in login raise last_exception File "C:\Users\keega\AppData\Local\Programs\Python\Python36-32\lib\", line 721, in login initial_response_ok=initial_response_ok) File "C:\Users\keega\AppData\Local\Programs\Python\Python36-32\lib\", line 642, in auth raise SMTPAuthenticationError(code, resp) smtplib.SMTPAuthenticationError: (534, b'5.7.14 <\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 c68-v6sm18546669pfj.51 - gsmtp')
Does anyone know what is wrong and how to fix it?
Thanks :)
This error is probably caused because Google blocks sign-in attempts from lesser secured apps. If you login to your gmail account you probably received also an email regarding a lesser secured app trying to sign in to your account?

If you want to turn off this safety feature you can do that here:
Here's a troubleshooting guide that should work.

Most likely problem is of "Allowing less secure apps" Go to THIS link and allow less secure apps to login into the account.
Hello Again,
Thank you it has worked. I already did this, but for some reason it didn't work but I did it again and now works fine.
Thank You Both

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python, sending E-mails Daxanius 1 1,498 Sep-05-2018, 03:49 PM
Last Post: buran
  Wrong or missing date format and time in mails sipriusPT 3 1,948 Aug-08-2017, 03:22 PM
Last Post: sipriusPT

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020