Sending E-mails - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Sending E-mails (/thread-12342.html) |
Sending E-mails - keegan_010 - Aug-21-2018 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. 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: Does anyone know what is wrong and how to fix it?Thanks :) RE: Sending E-mails - mlieqo - Aug-21-2018 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: https://www.google.com/settings/security/lesssecureapps RE: Sending E-mails - hbknjr - Aug-21-2018 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. RE: Sending E-mails - keegan_010 - Aug-21-2018 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 |