Gmail API - size limit batching of emails with att

2019-09-06 18:52发布

问题:

My application often requires to upload bulk emails to user's Gmail account. Currently, I am using JavaMail IMAP for doing this. However, I am now testing Gmail API (Java). A batch size of 25 emails with (approx 50KB) works perfectly and super fast outperforming IMAP by 4 times.

However, when I try to batch emails with attachment of 1MB, the batching is failing after 6 emails. I know that the API recommends a "media/resumable" upload https://developers.google.com/gmail/api/guides/uploads if size of upload is >5MB. Is the 5MB limit, applicable to entire batch or individual emails?

Also, with around 5MB of today payload with 5 emails, IMAP is outperforming both batch or media upload with the API by almost 20%.