Basic Auth is being disabled in Exchange Online / Office 365 on October 1st and you should switch to OAuth 2.0 for authentication purposes:
Daemons/Services: Password grant (MFA/2FA must be turned off for this account):
https://www.limilabs.com/blog/oauth2-password-grant-office365-exchange-imap-pop3-smtp
Daemons/Services: Client credential flow:
https://www.limilabs.com/blog/oauth2-client-credential-flow-office365-exchange-imap-pop3-smtp
Web apps (requires user interaction):
https://www.limilabs.com/blog/oauth2-web-flow-office365-exchange-imap-pop3-smtp
Standalone devices (requires very little interaction):
https://www.limilabs.com/blog/oauth2-device-flow-office365-exchange-imap-pop3-smtp
Desktop apps (requires user interaction):
https://www.limilabs.com/blog/oauth2-office365-exchange-imap-pop3-smtp
However Microsoft is randomly disabling basic auth for some tenants already.
If disabled, you can use a new feature in the Microsoft 365 admin center to request that it should not be disabled yet (until Oct 1st):
The post Office 365: Basic Auth being disabled before October 1st first appeared on Blog | Limilabs.