SMTP Authenication Failure - 5.7.57 and 5.7.139

Lance Luttrell 1 Reputation point
2022-01-03T15:56:13.267+00:00

I am attempting to enable a Multi-function device to scan documents and send via email.

However, in testing the SMTP settings of my account I get the following error message:

Send-MailMessage : The SMTP server requires a secure connection or the client was not authenticated. The server
response was: 5.7.57 Client not authenticated to send mail. Error: 535 5.7.139 Authentication unsuccessful, the
request did not meet the criteria to be authenticated successfully. Contact your administrator.

I have taken the following steps already:

  1. Referenced this article (https://learn.microsoft.com/en-us/Exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365?redirectSourcePath=%252fen-us%252farticle%252fhow-to-set-up-a-multifunction-device-or-application-to-send-email-using-office-365-69f58e99-c550-4274-ad18-c805d654b4c4#how-to-set-up-smtp-auth-client-submission) and determined the need to enable SMTP AUTH
  2. Referenced this article (https://learn.microsoft.com/en-us/Exchange/clients-and-mobile-in-exchange-online/authenticated-client-smtp-submission) and enabled SMTP AUTH for the account in question (and then later the whole organization in attempts to resolve)
  3. Referenced this article (https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9) to create an app password for the sending account
  4. Attempted direct login from the device
  5. Attempted using the following powershell command to send (with respective email addresses changed)

$cred = get-credential
$body = "This is a test email"
Send-MailMessage -To "testTO@test .com" -from "test@test .com" -Subject 'Test message' -Body $body -BodyAsHtml -smtpserver smtp.office365.com -usessl -Credential $cred -Port 587

I have tried using the get-credential feature as well as passing through a secured connection. I have tried multiple accounts all with the same result.

I have also tried to disable the Active Directory Security Defaults, but cannot enable a Custom Access Rule because I do not have the licenses.

Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

2 answers

Sort by: Most helpful
  1. JamesTran-MSFT 36,911 Reputation points Microsoft Employee Moderator
    2022-01-03T19:04:34.973+00:00

    @Lance Luttrell
    Thank you for your post!

    Adding onto what @Andy David - MVP said and based off your error message - Send-MailMessage : The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 Client not authenticated to send mail. Error: 535 5.7.139 Authentication unsuccessful..., I found a few Q&A threads that might help point you in the right direction.

    Following the - Error: Authentication unsuccessful documentation:
    Can you reference troubleshooting steps 3 and 4 to see if that helps. As @Kael Yao mentions, these settings would block Legacy Authentication. For more info.
    162003-image.png

    Additional Links:
    535 5.7.139 Authentication unsuccessful - Q&A
    535 5.7.139 Authentication unsuccessful - Microsoft 365 and Office Community

    If you have any other questions, please let me know.
    Thank you for your time and patience throughout this issue.

    ----------

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

    5 people found this answer helpful.

  2. Andy David - MVP 157.8K Reputation points
    2022-01-03T16:00:36.443+00:00

    If MFA reg is required for the account ( And it is Active Directory Security Defaults), then this wont work.

    3 people found this answer helpful.

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.