Search code examples
pythonsmtplib

Unable to run a simple SMTP server


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

senders='jsujith1311@gmail.com'
password="ekjhgisxavzw"#Not Original Password
connection=smtplib.SMTP("smtp.gmail.com")
connection.starttls()
connection.login(user=senders,password=password)
connection.sendmail(from_addr=senders,to_addrs=senders,msg="HI")
connection.close()

Can anyone help with this

I need a simple smtp server running on my device initially, then i want to configutre it according to my needs.


Solution

  • So, the answer is to use connection = smtplib.SMTP_SSL("smtp.gmail.com")

    and we have to remove the tls connection,I don't know why.But it worked.