To answer my own question:
beginning with python 3.3, you don't have to hack the smtplib as in this answer, but instead you can pass a SSLContext
object when using starttls
.
However, be aware: if the login data is wrong, it will still raise an error. If the login data is right, everything works fine if using the following code:
import smtplib
import ssl
context = ssl.SSLContext(ssl.PROTOCOL_SSLv3)
connection = smtplib.SMTP('smtp-mail.outlook.com', 587)
connection.ehlo()
connection.starttls(context=context)
connection.ehlo()
connection.login('now_your_real_login_data@outlook.com', 'otherwise_SMTPServerDisconnect')