I am trying to send mail from o365 user mailbox in python using exchangelib library. I am getting "exchangelib.errors.ErrorNonExistentMailbox: The SMTP address has no mailbox associated with it" this error.
credentials = Credentials(username='username', password='password')
my_account = Account(primary_smtp_address="my organization email address",
config=Configuration(
credentials=credentials,
service_endpoint='https://test/EWS/Exchange.asmx',
auth_type='NTLM',
# server='outlook.office365.com'
),
autodiscover=False, access_type=DELEGATE)
m = Message(account=my_account
, folder=my_account.sent
, subject=e_subject
, body=HTMLBody(e_body)
, to_recipients=[Mailbox(email_address='email address')])
m.send_and_save()
anyone know how to resolve this issue. Thanks in advance.
I am trying to send mail from o365 user mailbox in python using exchangelib library.