3

以下のコードを使用してメールを送信しようとしています。

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

ただし、以下のエラーが表示されます。

  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

私が間違っていることは何ですか?

4

1 に答える 1

1

何もないと思います。ファイアウォールの背後にいるか、hotmailが悪い日を過ごしている可能性があります。コマンドプロンプトから、を試してくださいtelnet smtp.live.com 587。応答がない場合は、接続に問題があります。

これが私が得る結果です:

$ telnet smtp.live.com 587
Trying 65.55.96.11...
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 
于 2012-07-31T02:39:40.410 に答える