One of the reasons its difficult to find information about this is because Microsoft keeps changing its API. For example, these two links show an API in change, that works now but will be obsolete in a few months.
this one
and this one
If you can't get this working, here's another idea:
Register another domain (e.g. examplebot.com) and add it to your hosting account as an add-on domain. Because it's part of the same hosting account, the primary domain can send email through it bypassing the Outlook.com servers entirely.
Here's what the config would look like under NodeJS:
First, you would need to install the nodemailer package.
Then, in your App.js (or whatever you called your backend file):
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
host: 'mail.examplebot.com',
port: 465,
secure: true,
auth: {
user: '[email protected]',
pass: 's3cr3tPassword',
},
tls: {
rejectUnauthorized: false,
},
});
Of course, you would need to create a mailbox for the user specified in your code ([email protected] / s3cr3tPassword).
I've done this before, specifically to get around the need to send emails through the Microsoft Office365 environment, and it worked for me.