Python Mailing timed out error -
i cannot send email python. there security issue. can give me hint? code:
import smtplib server = smtplib.smtp('smtp.gmail.com', 587) server.starttls() #next, log in server server.login("***@gmail.com", "password") #send mail msg = "hello!" # /n separates message headers server.sendmail("***@gmail.com", "***@gmail.com", msg) server.quit()
this error get:
server = smtplib.smtp('smtp.gmail.com', 587) file "d:\tools\lib\smtplib.py", line 244, in __init__ (code, msg) = self.connect(host, port) file "d:\tools\lib\smtplib.py", line 310, in connect raise socket.error, msg error: (10060, 'operation timed out')
you should use smtplib.smtp_ssl() because port 587 expects ssl(tls) go.
https://docs.python.org/2/library/smtplib.html#smtplib.smtp_ssl
Comments
Post a Comment