Share via

Error while sending email: 535 5.7.139 Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully

Anonymous
2025-05-23T22:30:28+00:00

Error while using SMTP connection to O365 account -

Error while sending email: 535 5.7.139 Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully. Contact your administrator. [YT4PR01CA0495.CANPRD01.PROD.OUTLOOK.COM 2025-05-23T17:14:09.364Z 08DD991457590AB3]

SmtpClientAuthenticationDisabled is set to false, STARTTLS is enabled in connection.

StartFragment

DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]

DEBUG SMTP: need username and password for authentication

DEBUG SMTP: protocolConnect returning false, host=smtp.office365.com, user=NitinNataraj, password=

DEBUG SMTP: useEhlo true, useAuth true

DEBUG SMTP: trying to connect to host "smtp.office365.com", port 587, isSSL false

220 YT4PR01CA0107.outlook.office365.com Microsoft ESMTP MAIL Service ready at Fri, 23 May 2025 22:34:46 +0000 [08DD980F003299C5]

DEBUG SMTP: connected to host "smtp.office365.com", port: 587

EHLO Nitin.home

250-YT4PR01CA0107.outlook.office365.com Hello [174.94.34.84]

250-SIZE 157286400

250-PIPELINING

250-DSN

250-ENHANCEDSTATUSCODES

250-STARTTLS

250-8BITMIME

250-BINARYMIME

250-CHUNKING

250 SMTPUTF8

DEBUG SMTP: Found extension "SIZE", arg "157286400"

DEBUG SMTP: Found extension "PIPELINING", arg ""

DEBUG SMTP: Found extension "DSN", arg ""

DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""

DEBUG SMTP: Found extension "STARTTLS", arg ""

DEBUG SMTP: Found extension "8BITMIME", arg ""

DEBUG SMTP: Found extension "BINARYMIME", arg ""

DEBUG SMTP: Found extension "CHUNKING", arg ""

DEBUG SMTP: Found extension "SMTPUTF8", arg ""

STARTTLS

220 2.0.0 SMTP server ready

EHLO Nitin.home

250-YT4PR01CA0107.outlook.office365.com Hello [174.94.34.84]

250-SIZE 157286400

250-PIPELINING

250-DSN

250-ENHANCEDSTATUSCODES

250-AUTH LOGIN XOAUTH2

250-8BITMIME

250-BINARYMIME

250-CHUNKING

250 SMTPUTF8

DEBUG SMTP: Found extension "SIZE", arg "157286400"

DEBUG SMTP: Found extension "PIPELINING", arg ""

DEBUG SMTP: Found extension "DSN", arg ""

DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""

DEBUG SMTP: Found extension "AUTH", arg "LOGIN XOAUTH2"

DEBUG SMTP: Found extension "8BITMIME", arg ""

DEBUG SMTP: Found extension "BINARYMIME", arg ""

DEBUG SMTP: Found extension "CHUNKING", arg ""

DEBUG SMTP: Found extension "SMTPUTF8", arg ""

DEBUG SMTP: protocolConnect login, host=smtp.office365.com, user=, password=

DEBUG SMTP: Attempt to authenticate using mechanisms: LOGIN PLAIN DIGEST-MD5 NTLM XOAUTH2

DEBUG SMTP: Using mechanism LOGIN

DEBUG SMTP: AUTH LOGIN command trace suppressed

DEBUG SMTP: AUTH LOGIN failed

DEBUG: Jakarta Mail version 1.6.7

DEBUG: successfully loaded resource: /META-INF/javamail.default.providers

DEBUG: Tables of loaded providers

DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle], com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle]}

DEBUG: Providers Listed By Protocol: {imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle], imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle]}

DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map

EndFragment

Basically its a Email connector in MuleSoft. Pls advise if any other config to be changed

Microsoft 365 and Office | Subscription, account, billing | For business | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

5 answers

Sort by: Most helpful
  1. Anonymous
    2025-05-31T04:22:03+00:00

    Have a nice day, Nitin-CFG! Just wanted to follow up on my second response regarding to your thread. If you have any questions or need more info, I'm always here to support you. If you think my reply is helpful to you, please remember to mark it as an answer. This helps others in the community facing similar problems.Looking forward to hearing from you soon!All the best,Hoang-D - MSFT | Microsoft Community Support Specialist

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2025-05-27T22:23:35+00:00

    Hi Nitin-CFG,

    Good day! Thank you for posting to Microsoft Community. We are happy to help you. 

    Based on your description, allow me to provide you with the information.

    To enable App password log-in to Entra Admin Center(entra.microsoft.com) with your Admin account.

    Go to Identity -> Users > All users -> Per-user MFA. 

    Choose the user that you want to set the app password -> enable MFA.

    Go to Services settings tab and choose "allow users to create app passwords to sign-in to non-browser apps"

    Scroll down -> save and wait for 15 minutes to apply the changes.

    Now you can go to My sign-in page (mysignins.microsoft.com/security-info)and adding your app password. 

    • Add sign-in method -> app password.

    Please let me know if you have any questions or concerns in the meantime. 

    Best regards,

    Hoang-D - MSFT | Microsoft Community Support Specialist

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2025-06-04T14:00:02+00:00

    this resolved the issue, thank you so much !!

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2025-05-26T17:05:28+00:00

    Hi Hoang, thank you for suggesting a solution.

    I do not see 'App Password' as an option here, is it something admin has to enable it ?

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2025-05-23T23:30:59+00:00

    Hi Customer,Thank you for posting your query to Microsoft Community!I have reviewed your message, let me break down the problem to solve it.You're getting an error that says: 535 5.7.139 Authentication unsuccessfulThis means Outlook is blocking the connection because it doesn’t recognize or allow the way your app is trying to log in.In your situation, Microsoft has disabled basic authentication (username + password) for security reasons. This means:

    • Even if your username and password are correct, Outlook won’t allow the connection unless it uses a more secure method.
    • Your app (MuleSoft) is likely using basic authentication, which is now blocked.
    • Even though SmtpClientAuthenticationDisabled is set to false, that only allows SMTP—but you still need to use a secure login method.

    Here are two options to fix it:***Option A: Use an App Password (If MFA is Enabled)***If your Microsoft 365 account has Multi-Factor Authentication (MFA) turned on:

    1. Go to https://mysignins.microsoft.com/security-info.
    2. Sign in with your Microsoft 365 account.
    3. Click “Add method” > Choose “App password”.
    4. Create a new app password (e.g., name it “MuleSoft SMTP”).
    5. Use this app password in your MuleSoft SMTP configuration instead of your regular password.

    ***Option B: Use OAuth 2.0 (Recommended for Long-Term Use)***If your app supports it (MuleSoft does), switch to OAuth 2.0 authentication:

    • This is the secure method Microsoft now recommends.
    • You’ll need to register your app in Azure Active Directory, then configure it to use OAuth tokens.

    This step is more technical—let me know if you want a guide or help setting it up.This is Step-by-Step to Use OAuth 2.0 with Microsoft 365

    1. Register an App in Azure 
      • Go to portal.azure.com → App registrations → New registration.
      • Set a name, and use http://localhost as redirect URI.
      • Save the Client IDTenant ID, and create a Client Secret.
    2. Add API Permissions 
      • Go to API permissions → Add Microsoft Graph → Application permissions → Add Mail.Send.
      • Click Grant admin consent.
    3. Configure MuleSoft 

    Now you can use the Send Mail operation in MuleSoft to send emails through Microsoft 365 using OAuth 2.0. Please let me know if you still need further assistance!

    Best Regards, 

    Hoang-D - MSFT | Microsoft Community Support Specialist

    Was this answer helpful?

    0 comments No comments