How to Increase Postfix Message Size Limit for Large Email Attachments (CentOS 6)


2 views

When your CentOS 6 server running Postfix rejects large emails with the error 552 5.3.4 Error: message file too big, it's hitting the default message size limitation. This restriction exists both for incoming and outgoing messages in Postfix's default configuration.

Postfix uses two main parameters to control message sizes:

message_size_limit = 10240000  # Default 10MB limit
mailbox_size_limit = 0         # 0 means unlimited

For modern email requirements with large attachments, I recommend these settings in /etc/postfix/main.cf:

# Set message size limit to 25MB (can be adjusted higher)
message_size_limit = 26214400

# Optional: Set mailbox limit if needed
mailbox_size_limit = 268435456  # 256MB

After modifying main.cf, always:

postfix check
service postfix reload

Test the new limits with:

postconf -d | grep size_limit
  • Ensure matching limits in any front-end webmail interfaces
  • Check available disk space on your mail server
  • Consider client timeout settings for large transfers

If changes don't take effect:

  1. Verify syntax in main.cf (no trailing whitespace)
  2. Check for overrides in master.cf
  3. Restart Postfix completely if reload doesn't work

When your Postfix server returns the error 552 5.3.4 Error: message file too big, it means the incoming email exceeds the default message size limit. This typically happens when:

  • Sending emails with large attachments
  • Forwarding messages that exceed the size threshold
  • Receiving newsletters or automated reports

The main configuration file for Postfix is typically found at:

/etc/postfix/main.cf

For some installations, you might also need to check:

/etc/postfix/master.cf

To increase the maximum allowed message size (including attachments), add or modify the following line in your main.cf:

message_size_limit = 31457280

This sets the limit to approximately 30MB (30 * 1024 * 1024 bytes). For different sizes:

# 50MB limit
message_size_limit = 52428800

# 100MB limit  
message_size_limit = 104857600

For complete email size management, consider these parameters:

mailbox_size_limit = 0          # No limit on mailbox size
header_size_limit = 102400      # 100KB for headers
virtual_mailbox_limit = 0       # No limit for virtual mailboxes

After modifying the configuration:

# Check configuration syntax
postfix check

# Reload Postfix
postfix reload

# Or restart completely (on some systems)
systemctl restart postfix

If changes don't take effect:

  • Check for overriding values in other included files
  • Verify proper file permissions (should be readable by postfix user)
  • Look for errors in /var/log/maillog

Remember that other MTAs in the delivery path might have their own size limitations.