How To Set Exchange Attachment Size Limit

How To Set Exchange Attachment Size Limit

Email often carries more than just a text message. It is also used as a medium for other types of data. If you want to send a document, an image or a spreadsheet simply attach it to your mail.

To protect mailbox databases from uncontrolled growth due to massive use of mail attachments, Microsoft Exchange 2013/2010/2007 incorporates a special set of message size limits in its configuration.

Message size limits

There are basically three places where you can configure default message size limits on Exchange:

  • Organization transport settings
  • Send/receive connector settings
  • User mailbox settings.

To check your server’s current limit you can open and access them via Exchange Management Console (EMC), however PowerShell offers a faster method that is available also on Office 365. Run the following code in the Exchange Management Shell, or after connecting with Office 365 via remote PowerShell session:

get-transportconfig | ft maxsendsize, maxreceivesize

get-receiveconnector | ft name, maxmessagesize

get-sendconnector | ft name, maxmessagesize

get-mailbox Administrator |ft Name, Maxsendsize, maxreceivesize

The result should be similar to the example visible on the screenshot below, which presents following limits:

  • Transport service accepts messages no larger than 25 MB
  • All send/receive connectors have message size limit set to 10 MB
  • There is no size limit set on the Administrator mailbox.


Bear in mind that the last line of the script (Get-Mailbox) returns information only about the Administrator’s user mailbox. Replace it with the user name you want to check. Alternatively, you can remove the Administrator phrase entirely, however this will result in a list of all mailboxes present on the Exchange.

To change the above size limits you can use a PS script too. The example below shows how to reduce the size of messages accepted by the transport service from the 25 MB to 15 MB.

Set-TransportConfig -MaxSendSize 30MB -MaxReceiveSize 30MB

Syntax of the command for send/receive connectors is similar, however you need to execute it for each connector’s identity. The same rule applies to mailboxes – you need to specify which mailboxes to affect by the command. Therefore, it is easier to pass over the result of the  Get- command directly to the Set- command. To do so – use the piping feature of PowerShell. E.g. setting a 10MB message size limit in  all mailboxes requires the following command:

Get-Mailbox | Set-Mailbox -MaxSendSize 30MB -MaxReceiveSize 30MB

The Get-mailbox command result is passed with the “|” pipe symbol to the Set-Mailbox command. This method works also for the send/receive connectors. The final script that sets the transport message size limit to 15 MB, send/receive connectors limits to 10 MB each, and the message size limit in all mailboxes to 10 MB presents as follows:

get-transportconfig | Set-TransportConfig -maxsendsize 15MB -maxreceivesize 15MB; get-receiveconnector | set-receiveconnector -maxmessagesize 10MB; get-sendconnector | set-sendconnector -maxmessagesize 10MB; get-mailbox | Set-Mailbox -Maxsendsize 10MB -maxreceivesize 10MB

There is a drawback however. Limits presented above are set for the message as a whole, no matter if they contain attachments or not. If the message is extremely large and contains no attachment, it will be stopped.

Attachment size limit

The only way to set size limits exclusively for attachments is to use a hub transport rule, which will detect and block messages if their attachments are over a specified size threshold.

To set up the rule you can use the below PowerShell script, as the method is quite simple:

New-TransportRule -Name LargeAttach -AttachmentSizeOver 30MB -RejectMessageReasonText "Message attachment size over 30MB – email rejected."

The command creates a rule named LargeAttach that is triggered by any email with attachments larger than 10MB. The rule then stops the message from delivery, and sends back a notification about that fact to the original sender.






Similar Posts