question

ArisLacdao-2249 avatar image
0 Votes"
ArisLacdao-2249 asked JayceYang-MSFT commented

Sending SMTP email via our website error 535 5.7.139 Authentication unsuccessful

We're sending email from our website via SMTP using noreply@ourcompany.com.

We are using these settings to send email:

 MAIL_MAILER=smtp
 MAIL_HOST=smtp.office365.com
 MAIL_PORT=587
 MAIL_USERNAME=noreply@ourcompany.com
 MAIL_PASSWORD=xxxxxxx
 MAIL_ENCRYPTION=tls
 MAIL_FROM_ADDRESS=noreply@ourcompany.com
 MAIL_FROM_NAME="NOREPLY"

MFA is enabled, SMTP AUTH is enabled and we created an App password for noreply@ourcompany.com.

Upon sending an email we are encountering an error: 535 5.7.139 Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully.

I already research how to fix this and I saw this question: https://docs.microsoft.com/en-us/answers/questions/512954/535-57139-authentication-unsuccessful.html

I can't set Enable security defaults to No because this account is company wide I want to keep this value to Yes. I just want noreply@ourcompany.com only to send emails via SMTP.

Then I saw that I can allow Legacy Authentication only on noreply@ourcompany.com via Conditional access maybe this will solve my problem. But when I go to Conditional Access I'm seeing this page:

201732-screenshot-from-2022-05-13-16-03-52.png


Our account is not on Azure AD Premium. So we cannot send SMTP email unless our account is on Premium?





office-exchange-server-mailflow
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

If the answer is helpful please click on ACCEPT ANSWER as it could help other members of the Microsoft Q&A community who have similar questions and are looking for solutions.

0 Votes 0 ·
michev avatar image
1 Vote"
michev answered ArisLacdao-2249 edited

You cannot use App passwords for SMTP send, you'll have to disable MFA for the account you want to send with.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


I have been researching this for the past 2 days. I've tried everything including disabling MFA. Its not working.

The thing is other people managed to make this work by enabling MFA and using App password.

The thing now that our account can't do is to Add Policies in Conditional Access. So what I'm validating now is do we need our account to be on premium in order to send SMTP from our website. Or is there another way to make this work even not on Premium.





0 Votes 0 ·
KaelYao-MSFT avatar image
0 Votes"
KaelYao-MSFT answered KaelYao-MSFT commented

Hi @ArisLacdao-2249

Please refer to this link: Basic Authentication Deprecation in Exchange Online – May 2022 Update

Here are some screenshots from the discussion:
202177-19.png

202147-20.png

If you would like to use basic auth, it is required to disabled Security Defaults.
Otherwise you may need to use modern auth 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.


19.png (41.8 KiB)
20.png (40.2 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @ArisLacdao-2249

Just checking in to see if above information was helpful. Please let us know if you would like further assistance.

0 Votes 0 ·