Error When Testing SMTP for Django Website

Wencong Cui 0 Reputation points
2023-12-27T16:23:50.9666667+00:00

I'm trying to link my email to my Django website via SMTP for sending newsletters to subscribers. However, when I try to test sending the email, I receive the following error message:

(535, b"5.7.139 Authentication unsuccessful, user is locked by your organization's security defaults policy. Contact your administrator. [MN2PR20CA0024.namprd20.prod.outlook.com 2023-12-27T04:58:32.658Z 08DC052365A41D9B]")

Note that I have already checked the Authenticated SMTP option for my account in the Microsoft 365 admin center. Any suggestions on how to fix this error?

Outlook Windows Classic Outlook for Windows For business
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Kael Yao 37,746 Reputation points Moderator
    2023-12-28T01:36:14.24+00:00

    Hi @Wencong Cui,

    From the error message it seems Django Website is using basic authentication for SMTP instead of Oauth, which by default is blocked by the security defaults in Azure.

    Please refer to this link to disable Azure security defaults and see if it can help with this issue:

    Disabling security defaults

    If the issue persists, please refer to this link to check other possible causes like conditional access policy:

    Error: Authentication unsuccessful


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.