Send message with big attachment
Found PR: https://github.com/O365/python-o365/pull/633
There's no any documentation about how to use it properly. I googled a lot and on one website scheme was:
- create message
- save it as a draft
- add attachments with createUploadSession
- send it
So i replicated this logic and wrote code:
m = self.account.new_message()
m.to.add(send_to)
m.subject = subject
m.body = body
m.save_draft()
m.attachments.add(attachments)
m.attachments._update_attachments_to_cloud()
m.send()
It works, but if it's a correct usage of sending big files? Method _update_attachments_to_cloud() has description that should not be used for non-draft messages
Don’t call _update_attachments_to_cloud() use save_draft() instead.
save draft will call update attachments to cloud.
So, the correct way is: add attachments first and then call save_draft() which will call uploadSession and finally send it?
That should do it