Take the 2-minute tour ×

I am trying to send an email using the below code:

s = smtplib.SMTP("smtp.live.com",587, timeout=120)
    s.login(user, pass)
msg["To"] = string.joinfields(bundle, ", ")
    s.sendmail(usuario, bundle, msg)

However I get the error below:

  File "C:\Python27\lib\smtplib.py", line 242, in __init__
    (code, msg) = self.connect(host, port)
  File "C:\Python27\lib\smtplib.py", line 302, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "C:\Python27\lib\smtplib.py", line 277, in _get_socket
    return socket.create_connection((port, host), timeout)
  File "C:\Python27\lib\socket.py", line 571, in create_connection
    raise err
error: [Errno 10060] A connection attempt failed because the connected party did
 not properly respond after a period of time, or established connection failed b
ecause connected host has failed to respond

What I am doing wrong?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Nothing, I think. Likely you are behind a firewall, or hotmail is having a bad day. From a command prompt, try telnet smtp.live.com 587. If you don't get a response, there's a problem with your connection.

Here's the result I get:

$ telnet smtp.live.com 587
Connected to smtp.hot.glbdns.microsoft.com.
Escape character is '^]'.
220 BLU0-SMTP406.phx.gbl Microsoft ESMTP MAIL Service, Version: 6.0.3790.4675 ready at  Mon, 30 Jul 2012 19:37:46 -0700 
share|improve this answer
Really, It's connection problem. It works in another machine. –  dextervip Jul 31 '12 at 2:45
That was an easy solution, then :) –  Max Jul 31 '12 at 2:48
add comment

Your Answer


