Apple Mail unable to send via Microsoft 365
We currently use a hosted Exchange 2016 server and are able to use Apple Mail on both macOS and iOS with this to send and receive emails with no problem.
We are in the process of migrating to Microsoft 365. I have tested this and whilst we are able to add Microsoft 365 accounts to Apple Mail and download and receive emails, when I try sending an email it gets stuck in the Outbox and does not get sent. Calendar is working.
Outlook for Mac on the same Mac works to both receive and send emails. When an email is sent via Outlook for Mac it also arrives at the other end with no problems.
Whilst no specific error message is shown by Mail and the Connection Doctor passes its test, I get a slight impression that the stuck mail in the Outbox is in an Outbox that does not appear to be linked to a specific email account. This is with macOS Sonoma.
As should be obvious from the fact that receiving emails is working, this means logging in via Apple Mail to Microsoft 365 did work and does bring up the Microsoft 365 login screen. (Microsoft some time ago changed from using password based logins to Oauth2 based web logins, this shows this works as emails are downloaded.)
For completeness of disclosure, we are using Mimecast for both the current Exchange server setup and Microsoft 365. I do not believe Mimecast is the problem since as mentioned Outlook is able to both receive and send emails and is also going to be going via Mimecast. The flow should in theory be
(Sending) Apple Mail --> Microsoft 365 --> Mimecast --> External Destination
for outgoing emails and as the email does not manage to leave the Mac it never reaches Mimecast.