A component of ASP.NET Core for creating RESTful web services that support HTTP-based communication between clients and servers.
Hi @Ajay Mahajan,
From what you've described, I think the problem might be that you are using App Password while MFA is disabled. Please make sure that you're not mixing up app password with regular password or OAuth2 tokens as app passwords are only valid if MFA is enabled. If MFA is disabled, you should use the regular password.
Other than that, you could try:
Verify SMTP Authentication Is Enabled
Even if MFA is disabled and security defaults are turned off, Office 365 tenants may still block SMTP authentication by default.
- Go to Exchange Admin Center → Settings → Mail Flow
- Ensure Authenticated SMTP is enabled for the user account you're using.
- Also check that SMTPClientAuthenticationDisabled is set to
falsefor the tenant
Set-TransportConfig -SmtpClientAuthenticationDisabled $false
This setting is often overlooked and is a frequent cause of the 535 error.
Check TLS Compatibility
Office 365 requires TLS 1.2 or higher. If your application or environment is using an older version (e.g., TLS 1.0 or 1.1), authentication will fail.
You can find more information here: https://learn.microsoft.com/en-us/microsoft-365-apps/end-of-support/microsoft-365-services-connectivity#basic-authentication-deprecation-in-exchange-online
- Ensure your application is configured to use
SecureSocketOptions.StartTlsand that TLS 1.2 is enabled in your environment. - You can force TLS 1.2 in your ASP.NET Core app by adding this in your program.cs:
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Try verifying if your Outlook credentials are correct via Web
It’s a good idea to verify your Outlook credentials by logging in through the web interface—just to be sure everything is working as expected. It doesn’t hurt to double-check.
Also please be noted, as others have pointed out, that Microsoft is phasing out support for basic security.
If you are still encountering problem, feel free to reach out and consider using Outlook and Office 365 if you feel the problem is tied to your account.