Hello @Golubev Maxim
Thank you for reaching out to Microsoft Q&A.
535: 5.7.3 Authentication unsuccessfulFor this error, on the Exchange online side, in addition to enabling authenticated SMTP submission, please check the following points:
1.Disable Multi-Factor Authentication (MFA) on the licensed mailbox that's being used:
- In the Microsoft 365 admin center, in the left navigation menu, choose Users > Active users.
- On the Active user's page, choose Multi-Factor Authentication.
- On the multi-factor authentication page, select the user and disable the Multi-Factor Authentication status.
2.Disable Azure security defaults
3.Check if you have set to exclude users in Conditional Access policies that block legacy authentication
Based on what you've described thus far it could be app side or even outlook given the next leg of the flow is to connect to outlook after acquiring the access token. This is the article we usually refer to in these scenarios Authenticate an IMAP, POP or SMTP connection using OAuth | Microsoft Docs.
Based on my search, since you received the errors 535 5.7.3 Authentication unsuccessful. There are a few things you need to check, see under Error: Authentication unsuccessful.
I hope this clarifies things. Please contact us if you have any additional questions.
Best regards,
Sakshi Devkante