File "C:UsersSanketPatilAppDataLocalProgramsPythonPython38libsmtplib.py", line 655, in auth
raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (535, b’5.7.139 Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully. Contact your administrator. [PN2PR01CA0009.INDPRD01.PROD.OUTLOOK.COM]’)
Process finished with exit code 1
I have enabled SMTP auth too
2
Answers
Issue is related to some security enablement’s or opening of ports related. You may try the below steps and try accessing. If it is working, then it can be confirmed related to default security and enable the required security features and re enable the security defaults.
Azure Active Directory
Properties
.Manage security defaults
.Enable security defaults
=No
.Save
buttonTaken References from:
Fix issues with printers, scanners, and LOB applications that send email using Microsoft 365 or Office 365 | Microsoft Docs
Еhere may be two possible causes of this issue. These settings would block Legacy Authentication: