[Tutor] sending email via smtplib

Saad Javed sbjaved at gmail.com
Mon Nov 19 06:32:25 CET 2012


I don't think using SSL works with hotmail. I tried using:

smtplib.*SMTP_SSL*("smtp.live.com", 587)
smtplib.login(user, passwd)
...

That gave this error:

Traceback (most recent call last):
  File "sendemail.py", line 22, in <module>
    smtp = smtplib.SMTP_SSL(smtp_srv, 587)
  File "/usr/lib/python2.7/smtplib.py", line 776, in __init__
    SMTP.__init__(self, host, port, local_hostname, timeout)
  File "/usr/lib/python2.7/smtplib.py", line 249, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python2.7/smtplib.py", line 309, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python2.7/smtplib.py", line 782, in _get_socket
    new_socket = ssl.wrap_socket(new_socket, self.keyfile, self.certfile)
  File "/usr/lib/python2.7/ssl.py", line 381, in wrap_socket
    ciphers=ciphers)
  File "/usr/lib/python2.7/ssl.py", line 143, in __init__
    self.do_handshake()
  File "/usr/lib/python2.7/ssl.py", line 305, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [Errno 1] _ssl.c:504: error:140770FC:SSL
routines:SSL23_GET_SERVER_HELLO:unknown protocol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121119/489fc4dc/attachment.html>


More information about the Tutor mailing list