python-o365 icon indicating copy to clipboard operation
python-o365 copied to clipboard

Creating a draft with a message without sending

Open jeroenvermunt opened this issue 3 years ago • 0 comments

Hi there,

I want to created reply draft, this way I can manually check if my system created the correct replies before sending.

I thought this would be possible as follows:

mailbox = account.mailbox()
    
m = mailbox.get_message('AAMkAGFjM2UyNjAwLTIyOWEtNGZlNi1hNDQ5LTVhYjhlYzhkMTAyYQBGAAAAAABe2tXWSxOYT7LtthAmyM_PBwDcO137eY0tRZUUB1nqJ9KZAAAAAAEJAADcO137eY0tRZUUB1nqJ9KZAABq4RTHAAA=?')
reply_m = m.reply()
reply_m.body = 'This is a reply'
    
data = {'body': {
        'content': reply_m.body}}
    
url = reply_m.build_url(
        reply_m._endpoints.get('get_message').format(id=reply_m.object_id))
    
reply_m.con.patch(url, data=data)

It kind of works. However, the results draft displays the raw html instead of an actual message:

image

Anyone know how this is possible and a possible solution?

jeroenvermunt avatar Sep 15 '22 10:09 jeroenvermunt