Python Forum
OSError with SMPT script - 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: OSError with SMPT script (/thread-39881.html)



OSError with SMPT script - Milan - Apr-28-2023

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.