Earlier while troubleshooting an error with PHP’s mail function I noticed an error in the maillog on a CentOS server. I know I have run into this error before and previously I fixed the issue by setting a larger size limit on the Postfix mailboxes. Below is information about the Postfix error in the maillog explaining mail cannot be delivered to a specific user because the mailbox has reached the maximum size allowed as configured in the Postfix main.cf file.
Postfix Error Located In /var/log/maillog:
- Mar 8 14:35:01 dev postfix/smtpd: 38CA821A830F: client=localhost.localdomain[127.0.0.1]
- Mar 8 14:35:01 dev postfix/cleanup: 38CA821A830F: message-id=<201103082035.p28KZ13C014591@dev.example.com>
- Mar 8 14:35:01 dev postfix/qmgr: 38CA821A830F: from=<email@example.com>, size=894, nrcpt=1 (queue active)
- Mar 8 14:35:01 dev postfix/local: 38CA821A830F: to=<firstname.lastname@example.org>, relay=local, delay=0.13, delays=0.08/0.02/0/0.04, dsn=5.2.2, status=bounced (cannot update mailbox /var/mail/user for user user. error writing message: File too large)
- Mar 8 14:35:01 dev postfix/bounce: 38CA821A830F: sender non-delivery notification: 5506721A8311
- Mar 8 14:35:01 dev postfix/qmgr: 38CA821A830F: removed
As you can seen in the above maillog output the error explains that the user “user” mailbox file, or /var/mail/user, has grown to large. Postfix sets a default limit on mailboxes of 50MB but this can easily be modified by adding the mailbox_size_limit in the Postfix configuration file main.cf. Use the information below to modify the Postfix mailbox size limit.
Modify Postfix Mailbox Size Limit:
- Edit Postfix Configuration File: Open the Postfix configuration file in your favorite text editor such as vi. On CentOS the main.cf file is located in the /etc/postfix/ directory by default. Search the file for the mailbox_size_limit and modify it from its current setting to 0 for no limit or add a larger limit such as 512000000 for roughly 500MB as shown in the below example. If the mailbox_size_limit is not in the file simply add it to the end of the main.cf configuration file.
- # Modify Mailbox Size Limits (Default = 50MB, 0 = unlimited, 512000000 = roughly 500MB)
- mailbox_size_limit = 0
- Reload Postfix: Once you have saved the changes to the main.cf file you will need to reload the Postfix configuration for the changes to take effect. Postfix can be reloaded by using the below syntax.
- [root@dev postfix]# /etc/init.d/postfix reload
- Reloading postfix: [ OK ]
- [root@dev postfix]#
- Test Postfix Mailbox Size Limit: Now test the new Postfix mailbox size limit by tailing the maillog file located in /var/log and sending mail to the user with the full mailbox via the CLI. You can send mail via the CLI on Linux by viewing a file and piping it to the mail command such as the below example.
- more /etc/resolv.conf | mail user
In the above example user is the name of the user whose mailbox was full as noticed in the initial error in the Postfix maillog.
The user should again be receiving mail. Make sure that you have plenty of disk space available if you set the mailbox_size_limit to unlimited.