O365 / python-o365

A simple python library to interact with Microsoft Graph and Office 365 API
Apache License 2.0
1.67k stars 421 forks source link

How large can a message *body* be with MSGraph 1.0? #308

Closed jessepink closed 5 years ago

jessepink commented 5 years ago

On rare occasion, I get this error message: 413 Client Error: Request Entity Too Large for url: https://graph.microsoft.com/v1.0/users/username@domain.com/sendMail

Essentially, I know that the email's body that it's trying to send is pretty large (it sends me an html comparison/diff chart of updates and when the page I'm scraping has significant changes, the email can get fairly large). The largest email that I've seen actually come through is about 1.5 MB after you include headers (admittedly insignificant in the grand scheme of things).

This is a message without attachments, that 1.5 MB is simply in the body of the (html formatted) email as text.

I'm sorry if this isn't exactly a python-O365 question, but I cannot find any answers on the MS docs either-- I can only see that emails are limited to 4MB attachments with graph API 1.0, and if that limit applies to emails as well, I don't believe I'd ever be that large anyway.

jessepink commented 5 years ago

image For what it's worth, I did check my maximum message size in our organizations exchange admin center for this email address... currently set to 35840 KB for sent messages.

alejcas commented 5 years ago

MS Graph limit is 4MB per request. So the limit is for the whole request.

That’s the only info I have right now

alejcas commented 5 years ago

Also try if using the Office365 protocol helps. Office365 rest api does not have the 4MB limit.

alejcas commented 5 years ago

Closing this as there is no answer