'Sending large emails through Exchange Online

I'm trying to find more ways to send big emails (with many large attachments) through Exchange Online.

The idea is that an app should be able to send an email as user (or potentially, a shared mailbox), but can't access existing messages inside user's mailbox.

  1. Microsoft Graph API (Mail.Send, Mail.Send.Shared) - there is a 4MB total HTTP request size limitation (base64 encoding limits the practical attachment size to 3MB). It's possible to create a email draft and upload the attachment with upload session, however it requires Mail.ReadWrite permissions and does not work with shared mailboxes (thats a known bug).
  2. SMTP AUTH (SMTP.Send) - works fine even with shared mailboxes, needs a separate token for consent and sending (https://outlook.office.com/SMTP.Send scope). However it requires enabling it tenant wide or per mailbox. It's considered legacy/insecure, but in practice should be fine with XOAUTH2 & TLS (as long as Basic Authentication is disabled)? Size limit seems to be high - 150MB, but there is some throttling per mailbox.
  3. Outlook REST API (beta/2.0/1.0) - similar to Microsoft Graph API, couldn't find any docs about request size limit. It deprecated and is getting removed in November 2022.
  4. EWS SOAP API - probably can upload larger attachments, but requires a lot of permissions (https://outlook.office365.com/EWS.AccessAsUser.All) and it's also deprecated.

Right now it seems that the best way to go is SMTP AUTH, but it will require some setup on users side.

Is there any other non-deprecated option except SMTP AUTH which does not need extra permissions to entire user's mailbox?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source