Change the maximum message size in Postfix
Set message_size_limit in bytes, allow for MIME overhead, and check the limits imposed by local delivery and downstream mail systems.
message_size_limit sets Postfix's maximum message size in bytes, including envelope information. The documented default is 10240000 bytes. Configure a deliberate positive limit rather than treating the attachment's file size as the message size.
Set a 20 MiB limit
postconf message_size_limit mailbox_size_limit virtual_mailbox_limit
sudo postconf -e 'message_size_limit = 20971520'
sudo postfix check
sudo postfix reload
20971520 bytes is 20 MiB, approximately 20.97 MB. Editing the same parameter in main.cf has the same effect; use one configuration-management path so automated deployments do not overwrite the change.
mailbox_size_limit is a separate setting for files written by the local(8) delivery agent. It is not a general quota across every mailbox backend. Its nonzero value must not be smaller than message_size_limit. If local delivery needs a larger file limit, adjust it intentionally; setting it to 0 disables that file-size limit and should not be an automatic part of increasing message size.
virtual_mailbox_limit applies to Postfix's virtual(8) delivery agent. If another program, such as a Dovecot LMTP service, performs delivery, check that program's limits and quotas instead.
Budget for the encoded message
| Configured size | Bytes |
|---|---|
| 20 MiB | 20971520 |
| 50 MiB | 52428800 |
| 100 MiB | 104857600 |
Base64 increases the encoded payload by roughly one third, with additional line breaks, MIME boundaries, headers, and message content. A 15 MiB attachment therefore needs more than a 20 MiB message budget. Measure the complete encoded message and leave appropriate headroom instead of using a bare 4:3 conversion as a guarantee.
Check every hop
Your Postfix limit does not override a client's attachment restriction, a filtering gateway's threshold, or the recipient server's limit. Receiving and sending limits can differ even within one service. Check the receiving service's current documentation rather than assuming a familiar attachment limit applies to inbound SMTP.
For very large files, a controlled download link may be more practical. Match access controls and link expiry to the recipient and the data involved.
Verify the boundary and rejection source
postconf message_size_limit mailbox_size_limit virtual_mailbox_limit
# On systems using this log location:
tail -f /var/log/mail.log
Send controlled messages below and above the intended limit. Trace each queue ID and distinguish local rejection from rejection by the next hop. A reply such as 552 5.3.4 can indicate a size problem, but the surrounding SMTP text and logs identify the enforcing system.
Do not use message_size_limit = 0 as a reset-to-default recipe. The parameter documentation does not give it the same documented unlimited semantics as mailbox_size_limit; restore the documented default explicitly if that is the goal. Excessively small limits can also prevent delivery of non-delivery notifications.
A pure outbound relay usually does not need local mailbox-size changes. It still needs enough queue storage, filtering capacity, and downstream acceptance for larger messages.
Reference
Contact us
Join the community
to join the community
Try Guance
Start online and pay only for what you use.
Get startedChoose a Guance plan