I am trying to write a python script which will send mails from Office 365 account which has 2 Factor Authentication. with smtp.office365.com,587 it does not work because of the 2FA.
host = yourdomain-com.mail.protection.outlook.com Port = 25 should be used as per the below link
but I am unable to configure the settings mentioned in the link as I am getting the below error
You don’t have permission to access this page or perform this action. CloseSupport Information Correlation ID:sea#4d1521bd-d123-488f-9a37-fbf34425f13b Error code:0
Is there any other way to login and send mails from Office 365 account having 2 Factor Authentication?