Monday, 15 March 2010

Errno 10060 python sending email through gmail -


I python 2.7 via a Gmail account. My code is below, any help is appreciated! I continue:

The Errno 10060 connection attempt failed because the connected party does not respond properly after a period of time ...

  Import Smtplib FROMADDR = "myemail@gmail.com" LOGIN = FROMADDR PASSWORD = "mypassword" TOADDRS = "toEmail@gmail.com" msg = "test message" server = smtplib.SMTP ('smtp.gmail.com ', 25, timeout = 120) server.set_debuglevel (1) server.ehlo () server.starttls () server.ehlo () server.login (login, password) server.sendmail (FROMADDR, TOADDRS, msg) server Quit () print "e-mail successfully"    

Nki you it worked fine for me when using Instead port port to connect on port 587:

  & gt; & Gt; & Gt; Import smtplib & gt; & Gt; & Gt; Server = smtplib.SMTP ('smtp.gmail.com', 587) & gt; & Gt; & Gt; Server.ehlo () (250, 'mx.google.com in your service, [99.178.174.213] \ nSZE 35882577 \ n8BITMIME \ nSTARTTLS \ nENHANCEDSTATUSCODES') & gt; & Gt; & Gt; Server.starttls () (220, '2.0.0 TLS ready to be started)) & gt; & Gt; & Gt; Server.ehlo & lt; Bound method SMTP.ehlo & lt; Smtplib.SMTP Example at 0x1e518c0 & gt; & Gt; & Gt; & Gt; & Gt; Server.login ('xxxxxxxxxxxx', 'xxxxxxxx') (235, '2.7.0 Approved') & gt; & Gt; & Gt; Msg = "test message" & gt; & Gt; & Gt; Server.sendmail ('xxxxxxxxxxxx@gmail.com ',' xxxxxxx @ yahoo.com ', msg) {} & gt; & Gt; & Gt; Server.quit () (221, '2.0.0 closing connection xxxxxxxxxxxxxxxx.x - gsmtp')    

No comments:

Post a Comment