Search code examples
python-3.xexchangewebservices

Why am I getting smtplib.SMTPAuthenticationError: (500, b'5.3.3 Unrecognized command') using code that worked a month ago?


I used the following code successfully last month to connect to and send mail through an Exchange server. I am using python 3.5.

import smtplib
# ...
s=smtplib.SMTP('outlook.office365.com', 587)
s.starttls()
s.login(user, pwd)

Today, it gives me

smtplib.SMTPAuthenticationError: (500, b'5.3.3 Unrecognized command')

I see a related bug report here but cannot figure out how that helps me.

What am I doing wrong?


Solution

  • This is a bug introduced in python 3.5.0: https://bugs.python.org/issue25446, this should be fixed in python 3.5.1. (I haven't tried this yet, as I only stumbled upon this question while researching this bug)

    Edit: just tested, smtplib + python 3.5.1 + office365 works