I am trying to send an email from my office365 corporate account using python. I am new to python. This code previously worked when using my hotmail account, however now that I
Most likely, the problem is not in your code, but in the Exchange Online configuration.
I bet 535 5.7.3 Authentication unsuccessful is thrown because authenticated SMTP (SMTP AUTH protocol) is disabled in your Exchange Online organization.
Here you can find my answer explaining how you can enable SMTP AUTH for the user you are sending emails from. You have to be an Office 365 org admin to do that, or you can ask your administrator for help.
After that mailserver.starttls() should work. Notice that you don't need to specify a certificate in that call.