web analytics

If you have a busy mailbox on a daily basis, then the following method will give you some more information about your e-mail messages. This is very useful if you are subscribed to many mailing lists (professional or not) and you want a clean inbox.

  1. You have to use procmail to distribute your incoming e-mail messages into appropriate mailboxes.
  2. You must enable procmail’s logging feature by including a line like


    into your ‘~/.procmailrc’ file (man procmailrc for more details)

  3. Download the statmail PERL script and install it in your ‘~/bin’ directory
  4. Set up a cron job like the following (everything goes in one line and remember to edit the pathnames):

    00 00 * * * /home/username/bin/statmail < /home/username/mail-from | /usr/bin/mailx -s "daily mail statistics" username@localhost && rm /home/username/mail-from

From now on (and every midnight), you ‘ll receive a new e-mail message containing an analytical report of how many messages you ‘ve received today (or, should I write, yesterday?) and the mailbox they were stored.

Visit The Light of the LAMP blog for more…

Daily distribution of emails

Buy me a coffee