Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully. Receiving the mentioned issue while configuring Office365 SMTP.

Prasenjit Hiwale 0 Reputation points
2023-10-26T09:19:21.2533333+00:00

I tried it with username, password-based authentication, and access token authentication. For which I'm receiving "535 5.7.139 Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully. Contact your administrator. [PN3PR01CA0091.INDPRD01.PROD.OUTLOOK.COM 2023-10-25T11:19:30.768Z 08DBD3E4FB96EBF9" this error even though the username and password or the access token is valid.

Following are the SMTP settings :

address = "smtp.office365.com"

port = 587

user_name = "{username}"

password = "{password}"

authentication = "login" I also tried "plain"

enable_starttls_auto = true,

Also,

Is there a way to fix the above issue without setting the organizational level security defaults as "disabled"?

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,058 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
3,889 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Kael Yao-MSFT 34,336 Reputation points Microsoft Vendor
    2023-10-27T01:28:37.7666667+00:00

    Hi @Prasenjit Hiwale

    Is there a way to fix the above issue without setting the organizational level security defaults as "disabled"?

    If you use basic authentication, it is not possible without disabling the Azure Security Defaults.

    To use basic authentication for SMTP, the requirements are:

    1.SMTP AUTH enabled for the mailbox

    2.MFA disabled for the mailbox

    3.Azure Security Defaults is set to disabled

    4.No conditional access policy applied to this mailbox which blocks basic authentication

    Otherwise you may need to consider using modern authentication instead.


    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.