python-o365
python-o365 copied to clipboard
Attachments more than 4 mb
Hello,
while i'm trying to attach such files to my message, getting an error requests.exceptions.HTTPError: 413 Client Error: Request Entity Too Large for url: https://graph.microsoft.com/v1.0/me/sendMail
How to handle?
For the moment is not posible, use the outlook protocol to send big attachments
Even when you aren't automating it, and you are going into the web application or desktop application, you can't attach them
Any update to this? I have my protocol set as MSGraphProtocol(api_version='beta') per the instructions in the readme for files above 4mb and am still receiving an error
https://docs.microsoft.com/en-us/graph/api/attachment-createuploadsession?view=graph-rest-1.0&tabs=http
https://docs.microsoft.com/en-us/graph/outlook-large-attachments?tabs=http
https://docs.microsoft.com/en-us/graph/known-issues#attaching-large-files-to-messages
I do not think sendMail is the endpoint you want to hit for large files.
I have got this working by calling .save_message() prior to adding the attachment and it looks like it is working. You might want to give this a try. It looks like this way it crates a draft and then uploads the attachment to draft and then sends it.
I have also raised an issue asking whether this is the correct approach to send mails with large attachment size here: https://github.com/O365/python-o365/issues/841
This is the correct approach but it's not documented anywhere
@janscas hopefully that wording is good enough, otherwise I can revise. Should allow this issue and related ones to be closed?
@janscas hopefully that wording is good enough, otherwise I can revise. Should allow this issue and related ones to be closed?
sure