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 into 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:
Hallo Franky,
vielen Dank für die Pflege dieser Info-Sammlung.
Wir hatten seit gestern ein Problem mit einem Exchange 2019, von dem Smartphones keine Attachement > 10 MB mehr laden wollten, obwohl in den oben beschriebenen Sektionen Werte für effektiv ca. 75 MB Attachement eingetragen waren. Ich habe das zigmal kontrolliert, sogar den Server während des Tages neu gestartet, aber kein Erfolg. Erst nachdem auf den Hauptknoten dies hier eingetragen wurde ging es nach „iisreset /restart“ endlich:
:: Default Web Site + Exchange Back End
%windir%\system32\inetsrv\appcmd.exe set config „Default Web Site/“ -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:104857600
%windir%\system32\inetsrv\appcmd.exe set config „Exchange Back End/“ -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:104857600
Gruß
Guido
Frage dazu:
Ist der Hinweis
„CUs ersetzen die web.config der vDirs.“ seit dem CU13 noch korrekt?
Das hat ja das Configuration Backup und Restore eingeführt.
Ich fände das gut, wenn das hier platziert werden würde
Vielen Dank, ich habe das schon länger versucht und bin (auch dank meiner EDGE Konfiguration) immer gescheitert, irgendwo war in der Konfig immer ein Flaschenhals (10MB) und den habe ich jetzt gefunden
Leider inhaltlich völlig falsch!
so wie Christina schreibt: TransportConfig gibt den Grenzwert vor, der von einer Mailbox nicht überschrieben werden kann.
Ausnahmen für ein Postfach gehen nur dann, wenn man die TransportConfig und die Connectors hoch schraubt, dann alle Postfächer limitiert und manche auf „unlimited“ setzt, damit die Organisationsgrenzen greifen …
Hallo Franky,
vielen Dank für die Anleitung. Ich bin ein großer Fan deiner Seite und du hast uns schon oft das Leben gerettet :-)
Aber leider funktioniert diese Anleitung bei uns nicht. Die Ablehnung bei größeren Mails nach extern, trotz eingestellter Größe (z.B. 100 MB) auf den Connectoren und dem speziellen Postfach (z.B. 100 MB) wird die Mail schon vom interne Exchange abgelehnt und verweist auf die Größe in der globalen TransportConfig. Das kann man deutlich im Rückläufer sehen.
Wie kann man also sicherstellen, dass dann wirklich nur ein Postfach höher senden und empfangen darf, wenn die TransportConfig doch wieder greift. Stelle ich die TransportConfig hoch ein, können zumindest intern alle größere Mails empfangen und senden, was aber nicht gewünscht ist.
Falls hier noch jemand eine Idee hat? :-)
Lieben Dank
Christina
Danke (!) Frank fürs Aufgreifen dieses Themas.
Mir fehlt zum besseren Verständnis der Microsoft-Server-ActiveSync Einstellungen, dass Zusammenspiel der Werte „maxAllowedContentLength“ und „maxRequestLength“.
-section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:30000000
-section:system.web/httpRuntime /maxRequestLength:10240
Bisher habe ich das so verstanden, dass die maximale Länge der httpRuntime Anfrage Teil der maximalen Länge des Inhaltes ist, der über den Anfragefilter läuft. Mit dieser Ansicht würde ich davon ausgehen, dass der max. Wert der httpRuntime Anfrage nicht angepasst werden muss, wenn nur größere Anlagen bei deinem EAS Clientzugriff zu versenden sind.
Verstehe ich das richtig so?
Kannst Du mir helfen, dass besser zu begreifen?
Bei dir lernt man immer wieder etwas dazu.
Danke dafür!