TimeoutError when using smtplib

30 views Asked by At

I'm trying to send an email using smtp in python, but the code failed. In the console it says:

TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

import smtplib

my_email = "[email protected]"
password = "krwznillogwscftw"

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()
0

There are 0 answers