A size limit for emails can be configured at various points on an Exchange server. The limits can be configured very granularly, for example at mailbox or protocol level. This article lists the options available.
This article also applies to Exchange 2016.
TransportConfig: Global size restriction
The global limits for emails are defined in TransportConfig. The limits in the TransportConfig apply to all Exchange servers in the organization. By default, sent and received emails must not be larger than 10MB. The settings can be checked with the following command:
Get-TransportConfig | fl MaxReceiveSize,MaxSendSize
For example, to allow 20MB emails, the following command can be used:
Set-TransportConfig -MaxReceiveSize 20MB -MaxSendSize 20MB
The limits of the transport config can be overwritten at mailbox level if required.
Mailbox: Granular limits for e-mails
The TransportConfig limits can be overwritten at mailbox level, allowing the maximum email size to be set granularly for each mailbox. In the default setting, all user mailboxes have the value "Unlimited", but this does not mean that there is no size restriction, but that in this case the global limit of the TransportConfig applies. The mailbox limits can be checked with the following command:
get-mailbox | ft name,MaxSendSize,MaxReceiveSize
The following command can be used to change the limit on a mailbox:
set-mailbox administrator -MaxSendSize 30MB -MaxReceiveSize 30MB
The mailbox limit overrides the TransportConfig limit. If 10MB is defined in the TransportConfig, but 20MB is permitted at mailbox level, the user may receive or send 20MB mails. The size limit then only applies to the configured mailboxes, so a user with a TransportConfig limit (MaxSendSize) of 10MB may not send a 15MB mail to a user with a mailbox limit (MaxReceiveSize) of 20MB.
Transmit and receive connectors
The size limit for emails can also be set for send and receive connectors. The default setting is 36MB for the receive connectors and 35MB for the send connectors. The values can be displayed with the following command:
Get-ReceiveConnector | ft name,maxmessagesize
Get-sendConnector | ft name,maxmessagesize
The values can be adjusted with the following commands:
Get-ReceiveConnector | Set-ReceiveConnector -MaxMessageSize 50MB
Get-sendConnector | Set-SendConnector -MaxMessageSize 50MB
ActiveSync: Size restriction for smartphones
For connections via ActiveSync protocol, 10MB mails are allowed in the default setting. However, the actual maximum size is smaller, as the Base64 encoding makes the mails approx. 33% larger. With a limit of 10MB, mails of approx. 7MB can be transferred via ActiveSync. Unfortunately, the limits cannot be set directly via CMDLet's of the Exchange Management Shell, but must be written in the web.config of the vDir. The following commands can be used for the ActiveSync limits:
%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/Microsoft-Server-ActiveSync/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:30000000
%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/Microsoft-Server-ActiveSync/" -section:system.web/httpRuntime /maxRequestLength:10240
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/Microsoft-Server-ActiveSync/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:30000000
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/Microsoft-Server-ActiveSync/" -section:system.web/httpRuntime /maxRequestLength:10240
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/Microsoft-Server-ActiveSync/" -section:appSettings /[key='MaxDocumentDataSize'].value:10240000
You have to be careful with the commands, some values are given in bytes, others in kilobytes. In the example above, the small numbers are in kilobytes, the large numbers in bytes. To simplify matters, here are the calculation steps for bytes and kilobytes including 33% overhead due to Base64 coding (for example, 50MB as the maximum size):
- KiloByte: 50 x 1.33 x 1024 = 68096 KB
- Byte: 50 x 1.33 x 1024 x 1024 = 69730304 Byte
Important note: CUs replace the web.config of the vDirs. After an update of the Exchange Server, the ActiveSync limits must be reconfigured, as these are not adopted after the installation of a CU.
The normal CMD is used to list the commands instead of the Exchange Management Shell:
Exchange Web Services (EWS)
For connections via Exchange Web Services (EWS), 64 MB mails are permitted in the standard setting. As with ActiveSync, the limits are stored in the web.config. All limits are specified here in bytes, the Base64 encoding does not have to be observed here. The following commands can be used to change the limits for EWS:
%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/ews/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:104857600
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:104857600
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSAnonymousHttpsBinding'].httpsTransport.maxReceivedMessageSize:104857600
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSAnonymousHttpBinding'].httpTransport.maxReceivedMessageSize:104857600
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSBasicHttpsBinding'].httpsTransport.maxReceivedMessageSize:104857600
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSBasicHttpBinding'].httpTransport.maxReceivedMessageSize:104857600
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSNegotiateHttpsBinding'].httpsTransport.maxReceivedMessageSize:104857600
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSNegotiateHttpBinding'].httpTransport.maxReceivedMessageSize:104857600
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSWSSecurityHttpsBinding'].httpsTransport.maxReceivedMessageSize:104857600
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSWSSecurityHttpBinding'].httpTransport.maxReceivedMessageSize:104857600
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSWSSecuritySymmetricKeyHttpsBinding'].httpsTransport.maxReceivedMessageSize:104857600
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSWSSecuritySymmetricKeyHttpBinding'].httpTransport.maxReceivedMessageSize:104857600
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSWSSecurityX509CertHttpsBinding'].httpsTransport.maxReceivedMessageSize:104857600
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSWSSecurityX509CertHttpBinding'].httpTransport.maxReceivedMessageSize:104857600
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /webHttpBinding.[name='EWSStreamingNegotiateHttpsBinding'].maxReceivedMessageSize:104857600
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /webHttpBinding.[name='EWSStreamingNegotiateHttpBinding'].maxReceivedMessageSize:104857600
Here is the calculation method for the EWS limits (100MB as an example):
- Byte: 100 x 1024 x 1024 = 104857600 Byte
The CMD is used to execute the commands, not the Exchange Management Shell:
OWA
Limits can also be set for OWA; by default, OWA allows 35MB emails. As with EWS and ActiveSync, the limits are saved in web.config, so they are lost when a CU is installed and must be reset. The following commands can be used to adjust the limit, again there are values in bytes and kilobytes:
%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/owa/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:52428800
%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/owa/" -section:system.web/httpRuntime /maxRequestLength:51200
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:52428800
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.web/httpRuntime /maxRequestLength:51200
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.serviceModel/bindings /webHttpBinding.[name='httpsBinding'].maxReceivedMessageSize:52428800
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.serviceModel/bindings /webHttpBinding.[name='httpBinding'].maxReceivedMessageSize:52428800
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.serviceModel/bindings /webHttpBinding.[name='httpsBinding'].readerQuotas.maxStringContentLength:52428800
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.serviceModel/bindings /webHttpBinding.[name='httpBinding'].readerQuotas.maxStringContentLength:52428800
Here is the calculation method for the OWA limits (50MB as an example):
- Byte: 50 x 1024 x 1024 = 52428800 Byte
- KiloByte: 50 x 1024 = 51200 KiloByte
The normal CMD is also used here to execute the commands: