It is sometimes hard to see where we have stale e-mail accounts, or accounts that are degrading the mail server by tons of files in one directory. I like to see what accounts have, so I wrote the attached Perl script to check each account and give me some basic usage information.
I installed mailstats in /etc/cron.weekly, so it runs at the same time my Clean spam from mail folder does(and, since cron runs alphabetic, mailstats runs after cleanspam). Thsi returns the following as a tab delimted list (inline) suitable for copy/paste into a spreadsheet.
It assumes e-mail accounts are stored as directories under some root directory, with a structure
and returns the client name, the account name, number of messages, total messages store (in kilobytes) and number of messages in the 'new' folder.
A large number of items in the New folder indicates an account that has not been checked recently, since any access to an account moves e-mail from new/ to cur/