mariusv.com

Watch as I awkwardly stumble through life

postfix - mailbox size limit and message size limit

Posted by Marius Voila on January 13, 2011 in London, U.K . — 0 comments This post contains 269 words

Postfix is my MTA of choice. I use it for my mailserver because its simplicity , security and sendmail-compatible (the widely used smtp in the world but not as secure). It is also extensible by plugging other servers for various purposes (antispam, antivirus,database etc).

I had one problem with file attachment larger than 10MB. Users couldn’t send it although I have setup squirrelmail (SM) to be able to attach files summed up more than 20MB and I had modified php settings as per here. The problem was not in SM setting. It was postfix. By default, attachment size that can be sent by postfix is 10MB ~ 10240000 byte. How did I know it? I looked in log file (for my system it is in /var/log/mail/errors. For other system, the file to look is /var/log/maillog). The line looked like this:

Jan 13 09:30:53 webmail postfix/sendmail[30775]: fatal: me@mymailserver.org(74): Message file too big

Solution

Open _ /etc/postfix/main.cf_ with a text editor of choice and find message_size_limit directive and change accordingly. If it is not there, add the directive like this:

message_size_limit = 20480000

This sets limit to 20MB.

Some other parameters you need to change are in file php.ini which is usually located in dir /etc. Set their parameters as above or higher values as below:

post_max_size = 20M
upload_max_filesize = 20M

reload or restart postfix when you’re done:

service postfix reload

or

service postfix restart

There’s also mailbox_size_limit directive. You need to change this if SM can not open mailbox sized more than 10 MB.