535 5.7.139 Authentication unsuccessful

Maurice Wegner 46 Reputation points
2021-08-13T11:12:53.717+00:00

We are receiving the following error using the Office 365 SMTP server to send mails:

535 5.7.139 Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully.

Same issue with MFA (+ App password) and without MFA. Authenticated SMTP is activated for the used account. Unfortunately the provided error message is a bit vague.

Request options:

host: 'smtp.office365.com',
port: 587,
auth: {
user: USER,
pass: PASS
}

optional additional tries included specific TLS config (requireTLS: true, tls: { ciphers: 'SSLv3' }) which also resulted in the same error message.

Authentication data is correct as changing them shows a different authentication error (535 5.7.139 Authentication unsuccessful, the user credentials were incorrect).

Using the given domain XXXX.mail.protection.outlook.com (port 25) is not constant as some IPs are blacklisted so this is not an option.

Any information what this error means and what it causes would be appreciated since we can only find recent unanswered information about this error.

Thanks in advance

JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
994 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,655 questions
{count} votes

Accepted answer
  1. Kael Yao-MSFT 37,651 Reputation points Microsoft Vendor
    2021-08-16T08:01:04.673+00:00

    Hi @Maurice Wegner

    To my knowledge, there may be other two possible causes of this issue.
    Please refer to this link and check point 3 (Azure Security Defaults) and point 4 (Conditional Access policy): Error: Authentication unsuccessful
    123478-08.jpg

    These settings would block Legacy Authentication.


    If the response is helpful, please click "Accept Answer" and upvote it.
    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.

    15 people found this answer helpful.

4 additional answers

Sort by: Most helpful
  1. Stephan Angele 21 Reputation points
    2021-08-31T19:11:46.347+00:00

    We got this error when we set up a Lexmark X736de MFP network scanner/printer

    the way to setup the printer is nicely explained here:

    The user account used for authentification needs to have a licenced exchange subscription so shared mailboxes do not work

    Azure Security Defaults are set to "NO"
    No conditional access policies are active but the selected user uses MFA Multifactor authentifaction anyway.

    When trying to scan we got errors like "535 5.7.139 authentication unsuccessful"

    You can check in azure acive directory --> users --> user that you want to authenticate --> sign-in logs for details

    As a work around you can use an APP PASSWORD which can be created by

    • login into the relevant o365 user account --> clicking on user icon in upper right corner on browser (office account, not brower profile) -> view account --> my sign-ins --> security info --> add method --> app password

    When setting up the smtp user account of the printer use the email address + app password (instead of the normal user password connected to MFA)

    4 people found this answer helpful.

  2. SteveITS 10 Reputation points
    2023-11-06T21:27:53.4933333+00:00

    I know this is an old message but it is a top search result and maybe this helps someone.

    To get SMTP Auth to work I had to exclude the account from all four of the "baseline" Conditional Access policies EVEN INCLUDING the two that are for tenant admins and Azure admins, which it isn't.  Otherwise 365 rejects the connection with message, "Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully." I found this because I tried to log in to maybe create an app password and it was still prompting me to set up MFA.

    Each user (or the tenant) also has to have SMTP Authentication enabled.

    2 people found this answer helpful.
    0 comments No comments

  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  4. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    1 deleted comment

    Comments have been turned off. Learn more

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.