How to set mailbox/attachment/message limits in Exchange 2019

etting message and mailbox limits in Exchange 2019 isn’t easy job, there are a lot of places where the settings need to be placed. I will try to go through every setting in this guide although I cannot promise I won’t miss something. :)

Before we begin

When you deploy fresh Exchange 2019 you want to set mailbox size limit for your users, retention policy for the mailboxes (how far ca nyou retrieve deleted messages) message size settings and attachment size settings (message size and attachment size are two different things), also limits for mobile devices are separate story. There are also limits on how many recipients can be in one message (I won’t cover that here) so be sure you also alter that if you need to send emails to large group of people.

All of the limits we are going to set are up to you and your specific environment. I’m going to enter some values, but in the end, you can set something entirely different. Also, some values don’t make sense. You can set attachment size limit to 300MB, but then again, nobody would be able to receive email with attachment that large. Establish what your organization needs and act accordingly.

Some of these settings can be defaulted after CU update, or regular update – be sure to check limits – ActiveSync in particular, after every huge update to your Exchange!

Let’s get to work.

Mailbox Size Limits (Quotas)

This is setting you need to think about and take into account how many users you have,do you have a lot of large attachments, what is the physical space you have on your drives, what Exchange license you have (Standard license can have max 5 DBs) and so on…

You will hear some people protesting about limits and want larger mailboxes for email.

Mailbox size is double-edged sword – it is convenient to have large mailbox, but it can also be performance and reliability issue since large mailboxes don’t behave very well in these terms.

So, think about this before you act, and don’t just put unlimited mailbox size, you will regret that decision, especially when problems start.

Ok, let’s define mailbox size for all our users.

Login to Exchange Admin Center and head to servers menu.

On servers menu select databases tab – select your database – I will select DB1, and click on edit (pencil)

Under limits menu, you have few settings – issue a warning – by default it is at 1.9GB – user will get warning that mailbox is almost full (archiving mailbox is advised)

If nothing happens, sending mails will be prohibited at 2GBs and user will not be able to send/receive email at 2.3GB.

Also, here you will define retention policy for deleted emails and deleted mailboxes.

I will change these values for the sake of this guide.

I changed values to 9GB, 9.8GB and 10.6GB. Deleted items and mailboxes to 45days.

Let’s go to the recipients menu | mailboxes tab I will select a user and edit him

Under mailbox usage menu (select More options to expand) for the user Zeljko Medic you can see that values I set earlier are applied.

If you have some users that are exception to this rule, you can define custom quotas for individuals.

I will edit another user, again, go to the mailbox usage under user you selected and click on Customize the quota settings for this mailbox. For this user I selected unlimited quota. You can also define custom values (more, or less space) if you wish.

Ok, we are done with Mailbox size quotas.

Attachments and Message size

I tried to send attachment which is 23MB in size. File is bigger than the server allows…

Ok, this is a broad topic because there are lot of places where limits needs to be changed

Here are couple of commands that will show you your current limits

Remeber to change InfoAdmin in the last command for the user you wish to see limit for.

get-transportconfig | ft maxsendsize, maxreceivesize 
get-receiveconnector | ft name, maxmessagesize 
get-sendconnector | ft name, maxmessagesize 
get-mailbox InfoAdmin |ft Name, Maxsendsize, maxreceivesize

In case I miss something, here is a good reference – https://docs.microsoft.com/en-us/exchange/mail-flow/message-size-limits?view=exchserver-2019

Ok, let’s start of with organizational settings

Organizational settings

Exchange admin center | mail flow | receive connector tab | click on … (more) and select Organization transport settings

We are going through limits tab. By default you can have 500 recipients, receive and send message size of 10MB. I will change to 1200 recipients, 50MB send and receive size

Save when you are done.

Receive Connector

Exchange admin center | mail flow | receive connector tab |

I have few connectors here, and I’m going to go through all of them.

For a start I will select “Client Frontend SBEX1” and select edit button (pencil)

On general tab I’m going to change Maximum receive message size from 36MB to 50MB. Save

Now, I will not be going through other four connectors (Client Proxy, Default Frontend, Default, Outbound Proxy…) Procedure is the same, so repeat it for other four connectors (or how many you have)

I went through all and changed to 50MB

There are also some other settings for connectors (which can be done via exchange management shell\powershell, so if you need something more special like “Maximum size of all header fields…” check the Microsoft link above.

Send Connector

Exchange admin center | mail flow | send connector tab |

I have two send connectors. One is between edge and mailbox role, and that one has unlimited send message size. Other one is the one that I selected below, that one is from the edge role to the internet (in your case it may be from the mailbox role to the internet)

Select the send connector you wish to edit and select edit (pencil)

On General tab – Maximum send message size is 10MB by default, I’m going to change it to 50MB – Save

After this is done I usually like to restart Exchange server for settings to refresh.

I also close/open Outlook clients on machines…

After these settings you should be able to send large files from Outlook.

In my case, it worked.

Before we wrap up this story, let’s check one more time all the commands from the beginning of this section. In my case all is great, just as I wanted.

But!

We are not done yet, there is one more section – mobile devices (ActiveSync), Exchange Web Services and Outlook on Web

Some of these settings you may need, some you may not.

Server Limits

ActiveSync, Exchange Web Services and Outlook on Web are story for itself. You can find more details on this link – https://docs.microsoft.com/en-us/exchange/architecture/client-access/client-message-size-limits?view=exchserver-2019

I will also use link above to source some of the screenshots below

ActiveSync

This is the part I’m often asked about. You get large attachment on your Android or iPhone and you are not able to download the attachment of forward it.

Check this part every time after you update your Exchange with CU and make sure values are not reset to default settings!

This is also the example on which I’m going to show you how you can configure Exchange Web Services and Outlook on Web (of course you have different locations for EWS an Outlook on Web).

These are the locations we need to configure

Screenshot from Microsoft

Ok, let’s go step by step.

Before you go ahead and edit web.config file in these locations, make sure you copy it first somewhere else for backup

Let’s continue

!! My Exchange is installed in – C:\Program Files\Microsoft\Exchange Server\V15\… but here I’m going to use Microsoft’s “%ExchangeInstallPath%” for that part of the path.

Client Access (frontend) (\HttpProxy\Sync\web.config)

In following path

%ExchangeInstallPath%FrontEnd\HttpProxy\Sync\web.config

Also we will need to edit

Backend (ClientAccess\Sync\web.config)

%ExchangeInstallPath%ClientAccess\Sync\web.config

Ok, I’m not going to open and edit these files manually (you can do it with notepad type in Notepad into windows search, right click on it and select “Run as Administrator”. Make sure while you navigate to the locations of the files below to open files from Notepad to select All Files (.) otherwise you will not see web.config files mentioned below!)

I’m going to do all of this this through command line

Open Command Prompt on Exchange Server as Administrator and run appcmd.exe from \windows\system32\inetsrv.

Don’t forget to change 30000000 (bytes), 10240 (kilobytes) and 10240000 (bytes) to values you like!!

%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

This is how it looks like, I moddified mine to 50MB

I also went on to open web.config files in Notepad to check if values are added – they are

Before we wrap this up, there is one more thing we need to do in IIS to check if everything is ok, because we added maxAllowedContentLength:30000000 to our web.config files

Open IIS | Sites | Default Web Site | Microsoft-Server-ActiveSync | select Configuration Editor from middle screen

On the top of the Configuration Editor click on section window.

Select system.webServer | security | requestFiltering

expand requestLimits and check maxAllowedContentLength part. Mine is in place and with the size I set it (default is 30000000)

Repeat the process in:

IIS | Sites | Exchange Back End | Microsoft-Server-ActiveSync | select Configuration Editor from middle screen

Result should be same.

Restart IIS for these settings to take place.

Before I set all this under ActiveSync I tried to send cca 30MB attachment from my iPhone. While large size attachments go without any problems from my Desktop Outlook, this was not the case from the Outlook on iOS

From iPhone I would get error “Unable to send the message: either the send quota has been exceeded; or the message was too large; or the mailbox is over-quota. Exchange ActiveSync error details: SendQuotaExceeded, Code = ‘115’.

After I did all the settings above, the message from iPhone went through without problems.

Exchange Web Services

I’m not going to repeat the process for these other services, more or less procedure is same as for ActiveSync (of course files are in different locations and there is no need for IIS check) and you can just follow the procedure here – https://docs.microsoft.com/en-us/exchange/architecture/client-access/client-message-size-limits?view=exchserver-2019

I’m just going to put quickly screenshot of file locations and values that need to be modified, and also commands you need to run in CMD on Exchange

Picture is courtesy of Microsoft, from the link above.

Open command prompt as admin and navigate to the folder described below and run following commands. If you don’t understand the concept, please look at ActiveSync example where I described everything

%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/ews/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:67108864

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:67108864

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSAnonymousHttpsBinding'].httpsTransport.maxReceivedMessageSize:67108864

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSAnonymousHttpBinding'].httpTransport.maxReceivedMessageSize:67108864

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSBasicHttpsBinding'].httpsTransport.maxReceivedMessageSize:67108864

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSBasicHttpBinding'].httpTransport.maxReceivedMessageSize:67108864

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSNegotiateHttpsBinding'].httpsTransport.maxReceivedMessageSize:67108864

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSNegotiateHttpBinding'].httpTransport.maxReceivedMessageSize:67108864

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSWSSecurityHttpsBinding'].httpsTransport.maxReceivedMessageSize:67108864

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSWSSecurityHttpBinding'].httpTransport.maxReceivedMessageSize:67108864

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSWSSecuritySymmetricKeyHttpsBinding'].httpsTransport.maxReceivedMessageSize:67108864

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSWSSecuritySymmetricKeyHttpBinding'].httpTransport.maxReceivedMessageSize:67108864

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSWSSecurityX509CertHttpsBinding'].httpsTransport.maxReceivedMessageSize:67108864

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSWSSecurityX509CertHttpBinding'].httpTransport.maxReceivedMessageSize:67108864

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /webHttpBinding.[name='EWSStreamingNegotiateHttpsBinding'].maxReceivedMessageSize:67108864

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /webHttpBinding.[name='EWSStreamingNegotiateHttpBinding'].maxReceivedMessageSize:67108864

Outlook on the Web

I’m not going to repeat the process for these other services, more or less procedure is same as for ActiveSync (of course files are in different locations and there is no need for IIS check) and you can just follow the procedure here – https://docs.microsoft.com/en-us/exchange/architecture/client-access/client-message-size-limits?view=exchserver-2019

I’m just going to put quickly screenshot of file locations and values that need to be modified, and also commands you need to run in CMD on Exchange

Picture is courtesy of Microsoft, from the link above.

Open command prompt as admin and navigate to the folder described below and run following commands. If you don’t understand the concept, please look at ActiveSync example where I described everything

%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/owa/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:35000000

%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/owa/" -section:system.web/httpRuntime /maxRequestLength:35000

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:35000000

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.web/httpRuntime /maxRequestLength:35000

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.serviceModel/bindings /webHttpBinding.[name='httpsBinding'].maxReceivedMessageSize:35000000

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.serviceModel/bindings /webHttpBinding.[name='httpBinding'].maxReceivedMessageSize:35000000

%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.serviceModel/bindings /webHttpBinding.[name='httpsBinding'].readerQuotas.maxStringContentLength:35000000

windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.serviceModel/bindings /webHttpBinding.[name='httpBinding'].readerQuotas.maxStringContentLength:35000000

Conclusion

In this guide we went thoroughly through Exchange and set limits for mailbox size, messages size, attachment size and recipient limit.

There is really a lot to go through, so please forgive me if I forgot a detail or two. Let me know if there is something you would like to add to this.

Disclaimer