Fix smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server – Python SMTP Tutorial

By | June 6, 2019

I test a python program to send an email to others by outlook email and i encouter an error:

smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server

The problem code is:

smtpObj = smtplib.SMTP(smtpHost, smtpPort)
smtpObj.login(sender,password)

How to fix this error?

The correct code is:

smtpObj = smtplib.SMTP(smtpHost, smtpPort)
smtpObj.ehlo()
smtpObj.starttls()
smtpObj.ehlo()    
smtpObj.login(sender,password)

So this code works.

Leave a Reply

Your email address will not be published. Required fields are marked *