Python Forum

Full Version: OSError with SMPT script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello team,

I have the following code

import smtplib

my_email = "[email protected]"
password = "asdfasdf"
connection = smtplib.SMTP("smtp.gmail.com")

connection.starttls()
connection.login(user=my_email, password=password)
connection.sendmail(from_addr=my_email, to_addrs="[email protected]", msg="Hello")
connection.close()
It displays the following error

Error:
OSError: [Errno 101] Network is unreachable
Could you please assist? Can't find anything helpful online.