Cannot send large messages via ActiveSync


SYMPTOMS

When sending larger messages via the ActiveSync service the message fails to send. Sending small emails works ok.

Some devices may return an error indicating that "The message that was sent to the server was rejected because the message was too large". Not all email clients may indicate the failure and could just keep the message in the outbox folder and keep retrying until removed from the folder.

CAUSE

A global IIS restriction preventing uploads larger than 49152 bytes. IIS sets a default value of 49152 bytes for the "UploadReadAheadSize" value which limits the amount of bytes allowed in the entity body of a request and the number of bytes a Web server will read into a buffer and pass to an ISAPI extension (which is how the ActiveSync service works).

Diagnosis:
  • Navigate within the IIS control panel applet to the "Sites" node.
  • Determine the ID for the "MailEnable Protocols" website
  • Next navigate to the IIS log files path: C:\inetpub\logs\LogFiles
  • Locate the W3SVC(ID) folder, where ID is the number of the website ID above in step 2.
  • Sort the log files by "Date Modified' and then open the latest log files in respect to the date/time you sent the message from the mobile device.
  • Search for lines like the examples below:

2013-11-27 23:43:48 192.168.0.1 POST /Microsoft-Server-ActiveSync User=test@mailenable.com.au&DeviceId=ApplDMRL2W3PF185&DeviceType=iPad&Cmd=SmartForward 443 - 192.168.0.2 Apple-iPad3C4/1102.55400001 413 0 0 6396

2013-11-27 23:43:48 192.168.0.1 POST /Microsoft-Server-ActiveSync User=test@mailenable.com.au&DeviceId=ApplDMRL2W3PF185&DeviceType=iPad&Cmd=SendMail 443 - 1921.68.0.2 Apple-iPad3C4/1102.55400001 413 0 0 6396

The above log snippets report a 413 error in the line which indicates the "Request Entity is too large". 

Also, IIS 7 and later have an upload limit of 30Mb, which limits the size that clients can post to the web server. To increase this you need to change the maxAllowedContentLength as described in the resolution below.

RESOLUTION

Open a Windows command prompt with administrator rights and navigate to the following location:

C:\inetpub\AdminScripts

Run the following command:

cscript adsutil.vbs set w3svc/14/uploadreadaheadsize 51200000

Where "14" in the above command is the website ID.

Changing the maxAllowedContentLength can be done in the IIS manager. Select the MailEnable Protocols website (or if you are running ActiveSync under another site, select that site). Select the Request Filtering option by doubling clicking it when in the Features View. In the Actiions pane on the right side of the screen click the Edit Feature Settings... link. Edit the Maximum allowed content length (Bytes) value to the maximum you want to accept.

REFERENCES

https://docs.microsoft.com/en-us/iis/configuration/system.webServer/serverRuntime



Product:MailEnable (ME-6.X Pro-Any Ent-Any)
Article:ME020605
Module:Other
Keywords:send,Activesync,UploadReadAheadSize,large,size,attachments,attachment
Class:TRB: Troubleshooting (Configuration or Environment)
Revised:Thursday, November 18, 2021
Author:
Publisher:MailEnable