The following code in python 3 raises an error on my computer, and I don't know how to log in properly:
import smtplib
connection = smtplib.SMTP('smtp-mail.outlook.com', 587)
connection.ehlo()
connection.starttls()
connection.ehlo()
connection.login('_these_dont_matter@outlook.com', '_the_error_persists_')
The last line produces the following output:
Traceback (most recent call last):
File "/usr/lib/python3.3/smtplib.py", line 366, in getreply
line = self.file.readline()
File "/usr/lib/python3.3/socket.py", line 297, in readinto
return self._sock.recv_into(b)
File "/usr/lib/python3.3/ssl.py", line 460, in recv_into
return self.read(nbytes, buffer)
File "/usr/lib/python3.3/ssl.py", line 334, in read
v = self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1504)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.3/smtplib.py", line 621, in login
AUTH_PLAIN + " " + encode_plain(user, password))
File "/usr/lib/python3.3/smtplib.py", line 398, in docmd
return self.getreply()
File "/usr/lib/python3.3/smtplib.py", line 370, in getreply
+ str(e))
smtplib.SMTPServerDisconnected: Connection unexpectedly closed: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1504)
The SMTP information (port, etc) I used is from a microsoft help site, other ports or domains for outlook I've tried result in the same error.
The output of openssl version
is 1.0.1e 11 Feb 2013