To send the email using office 365 exchange mail server, according to the Microsoft documentation office 365 exchange mail server API is discoverable using the email id and the password where the email id should be like onmicrosft.com (e.g. azure@ellerfield.onmicrosoft.com, admin@ellerfild.onmicrosoft.com) and there should be a license for the exchange mail which should be assigned to that specific email id. If these things are in place then the Microsoft exchange mail server api will able to discover the service path to send the mail. This is an alias that microsoft use on each email, for exapmle Azure@ellerfield.com.au = azure@ellerfield.onmicrosoft.com
If you need great Financial Advise check out www.ellerfield.com.au.