Is there a good howto on managing /var/spool/mail on a unix system someone might know about?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


It should have permission drwxrwsr-x owned by root.mail.

You should monitor the growth in file size, ie the size of mailbox of each user.

Nowadays modern email applications such as postfix and qmail support MailDir mailbox, instead of single file mailbox residing in /var/spool/mail. MailDir is more efficient and easier to manage. For example, you can set a cron job to clear out files older than n days in the Trash folder of each user.

There are a lot of ways to manage the spooling on linux. It depends on the mailing system you use.
Different programs for sendmail, exim or qmail
palazziniAuthor Commented:
I'm working with sendmail and would like to kow how to manually manage the mailbox.  Also if you have more than 1 user on the server is there is /var/spool/mail directory for each user or is there only 1 var/spoo/mail for the server only? I'm working at a web hosting company and this is a problem I encounter daily where the var directory is at 100% and needs to be cleaned out.  I know that the user needs to set his mail program to not leave mail on the server.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.


For sendmail, each user's mailbox will be a file with the username as filename inside /var/spool/mail.

Beside /var/spool/mail, you should also maintain the /var/log directory. Running logrotate with proper config will be sufficient to clean up old log entries.

palazziniAuthor Commented:
So you go into each users mailbox and lets say for arguement sake that there is mail there but the user can not download to his computer.  What steps would you take so that the user can download his mail?

You should check the log generated by your pop3/imap server to find out why the user cannot download the mail. It should be inside /var/log/mail.

You can send the mail file of the user to him/her, but then the user will need to use special tools to read the mbox file. That's why MailDir is a better option, each email is one single file. However, MailDir not supported by sendmail, yet.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
palazziniAuthor Commented:
First of all thanks for working with me on this problem ppgoong.  Will each user have a /var/log/mail/user file?  Once inside can u tell me some of the errors I would see and how to fix them?  You seem to be very knowledgable about email.

If the user has received email before, then they would have their mbox file inside /var/spool/mail. If the user haven't received any mail, the mbox file might not be created yet. If the mbox file is deleted, and new mail arrive, a new file with same filename will be created automatically.

There are many kind of errors, such as invalid username, invalid password, network interruption (time-out or unexpected session termination), etc, etc.

Kien KennedyCommented:
[root@test mail]$ pwd
[root@test mail]$ dir
user1 user2 jonh terry

Each users have a file in /var/spool/mail to store the content of email.

What do you want?
If you want users can download mail from /var/spool/mail/user you should setup a POP or IMAP server, and user(client ) can download mail with Mail Client Tools, such as Outlook Express, Evolution , ...

If you only want users can read their email from /var/spool/mail/user , you can use "neomail", this web based mail client can read content of mail in file in /var/spool/mail and display for user, when they login via web. This no need to setup a Pop or Imap server.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.