-
Notifications
You must be signed in to change notification settings - Fork 443
Closed
Labels
Milestone
Description
when attempting to send a message with an inline image, the below error occurs. when I remove the code for the image/attachment the mail sends
account = Account((credentials[0]['username'], credentials[0]['password']))
mailbox = account.mailbox()
message = mailbox.new_message()
message.attachments.add('https://www.image.com/email_banner.png')
att = message.attachments[0] # get the attachment object
att.is_inline = True
att.content_id = 'banner.png'
body += '<p><img src="cid:banner.png"></p>'
message.subject = 'Hello Test'
message.to.add(['user@user.com'])
message.body = body
message.send()
error
Client Error: 400 Client Error: Bad Request for url: https://graph.microsoft.com/v1.0/me/sendMail | Error Message: Required property is missing.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/site-packages/O365/message.py", line 602, in send
response = self.con.post(url, data=data)
File "/usr/local/lib/python3.6/site-packages/O365/connection.py", line 684, in post
return self.oauth_request(url, 'post', data=data, **kwargs)
File "/usr/local/lib/python3.6/site-packages/O365/connection.py", line 662, in oauth_request
return self._internal_request(self.session, url, method, **kwargs)
File "/usr/local/lib/python3.6/site-packages/O365/connection.py", line 627, in _internal_request
raise HTTPError('{} | Error Message: {}'.format(e.args[0], error_message), response=response) from None
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://graph.microsoft.com/v1.0/me/sendMail | Error Message: Required property is missing.