OK so I heard back from MS support nice and quickly. I didn’t have the settings correct. I’m a mechanical engineer by training so correct me if my terminology is wonky.
From the top:
You need a mailbox licence for the address that Discourse will use. I just added an Exchange Online seat at £2.50/pcm. Then set up a user for that email address.
I setup forum.mydomain.tld as a subdomain in O365 and then added the recommended DNS records at my domain registrar to hook it up to Microsoft’s records and point it at my Digital Ocean droplet.
Next set up a connector (O365 Admin page → Admin → Exchange → Mail Flow → Connectors). Create a new connector from ‘Your organisation’s email server’ to ‘Office 365’, then on the next panel tell O365 to identify email from an IP address - enter the IP address of your Discourse install. Hit save to create the connector.
Finally go to your domain management page and look at the DNS details for the domain you will be sending email from (for me it is mydomain.tld). Copy the address of the MX server - probably something like mydomain-tld.mail.protection.outlook.com
Then log in to the host of your docker, and edit your app.yml file to include the following:
DISCOURSE_SMTP_ADDRESS: [MX server address]
DISCOURSE_SMTP_PORT: 25
DISCOURSE_SMTP_USER_NAME: blank
DISCOURSE_SMTP_PASSWORD: blank
DISCOURSE_SMTP_AUTHENTICATION: none
DISCOURSE_SMTP_ENABLE_START_TLS: false
Rebuild your app and it should all work.
Matt