Microsoft 365 Exchange Online 150 MB Message Size - 夜莺博客

Microsoft 365 Exchange Online 150 MB Message Size

原文:Microsoft 365 Exchange Online 150 MB Message Size — theDXT (Daniel Keer)

Back in 2015, Microsoft enabled all Microsoft 365 (aka Office 365) Exchange Online tenants the ability to change their message sizes to a maximum size of 150 MB. Originally the default size was 25 MB and previously Microsoft increased that to 35 MB, your tenant will likely be set to one of those values.

The new 150 MB message size limit is not enabled by default you must enable it. In this post, I will detail step-by-step how to change the message size limit in Exchange Online for all existing mailboxes and all new mailboxes.

Prerequisites

The Process

  • Connect to Exchange Online with PowerShell
  • Run the following PowerShell command to see what the current message size limit is Get-Mailbox -Resultsize Unlimited | Format-List displayname,MaxSendSize,MaxReceiveSize

Image 2

Checking the current message size limit

  • Run the following PowerShell command to set all existing mailboxes to 150 MB Get-Mailbox -Resultsize Unlimited | Set-Mailbox -MaxReceiveSize 150MB -MaxSendSize 150MB

Image 3

Increasing the message size limit

  • Confirm the settings are applied by running the following PowerShell command again Get-Mailbox -Resultsize Unlimited | Format-List displayname,MaxSendSize,MaxReceiveSize

Image 4

Confirming that the increased message size limit is applied

The steps above only change the message size for any existing mailboxes. We also need to change the defaults so that the new message size applies to any new mailboxes that are created.

  • Run the following PowerShell command to see what the current default message size is for new mailboxes Get-MailboxPlan | FL MaxSendSize, MaxReceiveSize, name

Image 5

Checking the default message size limit for new mailboxes

  • Run the following PowerShell command to set the default message size to be 150 MB Get-MailboxPlan | Set-MailboxPlan -MaxSendSize 150MB -MaxReceiveSize 150MB

Image 6

Increasing the message size limit for new mailboxes

  • Confirm the settings are applied by running the following PowerShell command again Get-MailboxPlan | FL MaxSendSize, MaxReceiveSize, name

Image 7

Confirming that the increased message size limit is applied for new mailboxes

You may have noticed that I am not calling this an attachment setting as this message size limit applies to the whole email not just the attachments. In reality, you’d be able to attach up to 149 MB of attachments to the email be that one attachment totaling 149 MB or multiple attachments that don’t surpass 149 MB.

Just because the message size limit on your side is set to 150 MB, it does not mean the recipient supports it and that could result in bouncebacks from the recipient.

There are a few other things to be aware of, Outlook for Windows or Mac will honor the message size limit but OWA and Outlook for iOS or Android doesn’t.

Connecting to Exchange Online PowerShell

Every command below runs from the Exchange Online PowerShell module, not from a plain Windows PowerShell session. Install and connect first:

Install-Module -Name ExchangeOnlineManagement -Scope CurrentUser
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName admin@contoso.onmicrosoft.com

Recent versions also support Connect-ExchangeOnline -Device for hosts without a browser, and Disconnect-ExchangeOnline when you are finished. The older technique of opening a remote PowerShell session with New-PSSession -ConnectionUri https://outlook.office365.com/powershell-liveid/ will fail on any current tenant, because basic authentication has been retired for Exchange Online remote PowerShell - if you are following an old blog post and get an authentication error, that is almost certainly why.

What Organization Customization Actually Enables

The prerequisite is easy to trip over. Microsoft 365 organization customization is a one-time tenant flag that unlocks several otherwise-hidden Exchange Online features, and a tenant that has never had it enabled will return a confusing error from commands that look unrelated. Enable it once with a single cmdlet:

Enable-OrganizationCustomization

There is no output on success and it takes effect immediately. The related guide on Microsoft 365 organization customization covers the surrounding context if you have not hit the flag before. Be aware that the change is one-way: once enabled it cannot be turned back off, so run it deliberately rather than as a troubleshooting experiment.

Three Separate Settings Can Cap Message Size

People routinely raise one limit and are still blocked, because three independent values can cap a message:

  • Mailbox MaxSendSize and MaxReceiveSize - the per-mailbox limits changed by the commands in this article.
  • Mailbox plan defaults - the template applied to newly created mailboxes, read with Get-MailboxPlan.
  • Transport rules and connector limits - a connector or mail-flow rule can impose its own maximum, and data loss prevention policies can add size ceilings of their own.

If a mailbox is set to 150 MB but messages still bounce, the plan or a transport rule is almost always the culprit. It is worth understanding which of the three you are changing before you change it.

Test on One Mailbox Before Changing the Tenant

Before running a tenant-wide pipeline, verify the effect on a single mailbox. It is much easier to reason about and trivial to roll back:

Get-Mailbox -Identity user@contoso.com | Format-List DisplayName,MaxSendSize,MaxReceiveSize

Set-Mailbox -Identity user@contoso.com -MaxSendSize 150MB -MaxReceiveSize 150MB

Get-Mailbox -Identity user@contoso.com | Format-List DisplayName,MaxSendSize,MaxReceiveSize

The set-then-read-back pattern matters here. Exchange Online applies the change to the mailbox object immediately but caches it in the client connection, so a mail client may not see the new limit until it reconnects or re-authenticates. If you are testing with Outlook for Windows, restart the client after the change before concluding that the limit did not take effect.

Applying the Limit to a Subset with Filters

Tenant-wide Get-Mailbox -ResultSize Unlimited | Set-Mailbox ... is fine once, but a pipeline without a filter has bitten enough engineers that a targeted version is worth keeping in the toolbox:

# Only one department
Get-Mailbox -Filter "Department -eq 'Sales'" -ResultSize Unlimited |
    Set-Mailbox -MaxSendSize 150MB -MaxReceiveSize 150MB

# Only user mailboxes, excluding shared and resource mailboxes
Get-Mailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited |
    Set-Mailbox -MaxSendSize 150MB -MaxReceiveSize 150MB

# Everything except a handful of exceptions
Get-Mailbox -ResultSize Unlimited |
    Where-Object { $_.PrimarySmtpAddress -notin @('legal@contoso.com','archive@contoso.com') } |
    Set-Mailbox -MaxSendSize 150MB -MaxReceiveSize 150MB

Run the selection half of the pipeline on its own first - replace Set-Mailbox with Select-Object DisplayName,PrimarySmtpAddress - and check the resulting list before piping it into a write operation. A mis-typed filter that empties the pipeline runs silently and looks like success, which is the most expensive kind of mistake to discover later.

Driving the Change from a CSV

When the mailboxes to change come from a spreadsheet, drive the loop from a CSV rather than trying to encode the logic in a filter:

# mailboxes.csv contains a single column: Identity
Import-Csv .\mailboxes.csv | ForEach-Object {
    Set-Mailbox -Identity $_.Identity -MaxSendSize 150MB -MaxReceiveSize 150MB -ErrorAction Stop
    Write-Output "Updated $($_.Identity)"
}

Adding the Write-Output line and -ErrorAction Stop inside a try/catch turns a blind loop into something you can audit when a helpdesk ticket says one mailbox was missed. Without them, a single bad identity produces pages of red text and a partially applied change that nobody wants to untangle afterwards.

What Else Caps Message Size

Three settings outside Set-Mailbox are worth checking in the same session, because any of them can silently override what you just configured:

  • Get-TransportConfig | Format-List MaxSendSize,MaxReceiveSize - the tenant-wide ceiling. A mailbox cannot exceed it, however high the mailbox object is set.
  • Get-MailboxPlan - the template applied to new mailboxes only, as covered earlier in this article.
  • Per-mailbox MaxSendSize on the source and MaxReceiveSize on the destination - both apply to any given message, and the lower of the two wins.

That last point explains a bounce that seems impossible: a message between two mailboxes both configured for 150 MB can still be rejected if the tenant transport config was never raised, or if the destination mailbox was missed by the loop. Read all three when a bounce reports a size problem.

Large Attachments Without Raising the Limit

Raising the mailbox limit only helps when the recipient also supports it, and an external recipient on a 25 MB platform will still bounce your 140 MB message. The alternative is to stop sending the file and send a link instead. Share a file from OneDrive or SharePoint and Outlook inserts a reference in the message body - the attachment never traverses SMTP, so no message size limit applies at all:

  • Attach through the "Attach file, browse locations" flow in Outlook to get a shared link inserted automatically rather than copied into the message.
  • Set an appropriate external-sharing policy on the SharePoint site, or the recipient will receive a link they cannot open.
  • For bulk or automated transfers, upload to a library and send the URL rather than attaching anything at all.

The related guide on Microsoft 365 audit logging is useful here: shared-link activity is recorded in the unified audit log, so after sending a link rather than an attachment you can still see whether the file was downloaded and by whom. Raising a mailbox message limit does not create that trail.

Rolling the Setting Back

If you need to revert, apply the same commands with the previous limit. The default on a modern tenant is 35 MB, so:

Get-Mailbox -ResultSize Unlimited | Set-Mailbox -MaxSendSize 35MB -MaxReceiveSize 35MB
Get-MailboxPlan | Set-MailboxPlan -MaxSendSize 35MB -MaxReceiveSize 35MB

Record the values you saw in the first Get-Mailbox output before changing anything - that is your restore point, and it is the one piece of information people forget to save. If you have already made the change and lost the originals, the mailbox plan output tells you what a new mailbox would have received, which is the correct baseline to restore to. Worth remembering too that because this is a per-mailbox setting rather than a policy, a rollback has to be executed as explicitly as the original change was; there is no group policy object, or template, to fall back on.

If you want to learn about message size limits you can read about it in Microsoft’s documentation here.