Tuesday, November 07, 2006

Postfix message and mailbox size limits

I learned some more about Postfix today.

This morning I got a call from my client with the new mail server. They were getting an error message when trying to send a file with a 7 MB attachment. Since they send and receive a lot of attachments (of which a 7 meg file would be on the small side) this needed to be fixed. The message they were getting indicated and inability to access a mailbox. I skimmed through /var/log/maillog and found this:


Nov 7 10:48:47 postoffice postfix/local[14046]: 0671D344040: to=, relay=local, delay=33, status=bounced (cannot access mailbox /var/spool/mail/foo for user foo. error writing message: File too large)

I was a bit surprised, since I made sure that /etc/postfix/main.cf did not include any limits on email sizes. After some time searching on Google, it looked like the default value for a mailbox size according to Postfix is 51200000 bytes. I wanted it to be unlimited, so I used postconf to explicitly set the value to 0, for no limit, like so...

% postconf –e mailbox_size_limit=0

... then restarted Postfix.

I then tried to send a 12 MB file from my Gmail account to my test account on the box. I got an SMTP 552 error, “Message too large” back from the box. Again, I skimmed the maillog file and this time came across:

Nov 7 15:51:33 postoffice postfix/postdrop[14200]: warning: uid=48: File too large

Back to Google, whereupon I learnt that the default max message size for Postfix is 10240000 bytes. To fix it I ran:

% postconf –e message_size_limit=0

Again, I restarted Postfix and then resent my test email. This time it went through.

If you want to view the default settings for all the parameters you can configure in main.cf, use postconf –d. The output of postconf –d | grep size looks like:

[root@foo]# postconf -d | grep size
berkeley_db_create_buffer_size = 16777216
berkeley_db_read_buffer_size = 131072
body_checks_size_limit = 51200
bounce_size_limit = 50000
header_size_limit = 102400
mailbox_size_limit = 51200000
message_size_limit = 10240000

As an aside, since Postfix on this box is started by MailScanner, I restarted the MailScanner daemon to restart Postfix, like this:

% /etc/init.d/MailScanner restart

... which stops the inbound and outbound Postfix queus then starts them again.

13 comments:

Anonymous said...

THANKS for the Post. I had the same problem and couldn't figure out how to solve the problem. I knew it has to be something with the mailbox size, but am new to Unix [or the Unix part of OS X, I am a Mac user] and recently started using the Postfix within OS X client for our 3 person compamy

Tom
[@corbett.be]

Lee,WonChan said...

thanks good article.
but, if you use virtual mailbox then setting also virtual_mailbox_limit property to 0.

postconf -d | grep virtual_mailbox_limit
virtual_mailbox_limit = 51200000

It's default value is 51200000.

Have a good time~

Anonymous said...

Hello, I tryed to send an email from yahoo to another server, so I received an "Undelivered Mail..." wich says about Postifx, an the reason "cannot access mailbox:file to large", but is a word document of 252 kb...does id means that the email didn;t get to the destination...or it did?
Thank you!

Dave Markowitz said...

It sounds to me like the email was rejected and did not make it to its recipient.

Anonymous said...

thanks, this was handy!

Ryan Nutick said...

Thank you for this. Ran into this issue today and this was VERY helpful in resolving it.

intonk said...

Thanks this was VERY helpful

Anonymous said...

Good one

Tara said...

Hello,

Thanks for this nice article.
We are facing similar issue. The message_size_limit = 10240000 but it is throwing error with a attachment of 7.6 MB file size. However its a zipped file. Original Unzipped file is 55 MB size. I am not sure it has to be anything with unzipped file but just want to point it out.
Any ideas?

Unknown said...

the attachment real size is 4/3 apparent size, as it is base64 encoded, serach mime base64 on wikipedia

Anonymous said...

hey!! How r u storing the customer mails in the mail server? Is there a way to store them in encrypted fashion, so that no body can read them?

Anonymous said...

Thanks, just what I was looking for.

Unknown said...

I faced the same issue . Please look the variable "Message size limit" in /etc/MailScanner/MailScanner.conf file, by default it will be "0" (No value). change the value accordingly.