Otherwise, the issue is most likely that the authenticated SMTP (SMTP AUTH protocol) is disabled in your Exchange Online organization.
SMTP AUTH can be enabled/disabled on the organization level, or per-mailbox. Because SMTP AUTH only uses basic authentication, Microsoft recommends disabling it on the organization level and enable it only for individual accounts that still require it.
If security defaults are enabled in the organization, then SMTP AUTH is disabled.
SMTP AUTH can be enabled in Microsoft 365 admin centre or using Exchange Online Powershell.
To make it simple, to enable SMTP AUTH for a single account:
- Go to the Microsoft 365 admin center (https://admin.microsoft.com/) > Users > Active users.
- Select the user you are going to send emails from, and go to the Mail tab.
- In the Email apps section click Manage email apps.
- Enable Authenticated SMTP and click Save changes.
After that, you should be able to authenticate using the respective account.
Important: You need admin rights in your Office 365 organization to do that. Otherwise, ask your O365 org admin for help.