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
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 15MB -MaxReceiveSize 15MB
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 10MB -RejectMessageReasonText "Message attachment size over 10MB – 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.
Set the message size according to your specification.