MailWatch is a program to analyze mail moving through a mailing list. As each message is received, it gathers a summary of the message and stores it into a log. Later, Mailwatch can generate a textual report, showing number of posts during a time period, who the most prolific posters were, and what the most popular topics were.
Mailwatch can be installed as an alias to a mailing list on a local system by using a piped alias, like this:
or it can be driven by Procmail. I used procmail for my setup, which requires a rule like this:
:c ^(To|Cc): .*jobseekers.* | /usr/local/bin/formail -a "Status: O" >> /u/shevett/Mail/somelist : ^(To|Cc): .*somelist.* | bin/mw.pl
Note that for this mail (mail from the 'somelist' mailing list), I already had a rule in place for it, so I needed to add the 'c' (continue) flag on the original rule, and add another rule.
Without any command line parameters, Mailwatch processes stdin into a summary line, and put it out on stdout. Normally, you'd want to log this information into a file via the '-l' option, for later processing.
Usage: mw4.pl [-s] [-V] [-l logfile] [-t title] [-d days] [-n number] -s Output a summary instead of taking input. -V Show version information. -v Be verbose - show processing information while working. -l logfile Use this logfile instead of STDIN and STDOUT. (If you have trouble with suid/sgid, don't use this.) -t title Display this title on the top of the Summary Report instead of the default, the logfile name. -d days Look back this many days instead of the default of 7. -n topnumber Display this number of Top Posters and Subjects instead of the default of 10. -y Don't evaluate today's mail. Only look at yesterday and before. mw4.pl takes email, distills it and writes out summary information. When invoked with the "-s" option, it analyses and prints out interesting summary information. IE. Pipe your favorite mailing list traffic into: mw4.pl -l maillog In a week, run: mw4.pl -s -l maillog
Virus Report - Mailwatch is used here to track how many virii are being caught in a mail gateway.
Spam report - Here we're using Mailwatch to see how much mail is being caught via spam filters on a daily basis to a single user (yes, those are real numbers :)
Mailwatch is distributed under the Artistic License.
The code is ever-evolving. The latest version is version 0.44, and is available here, and requires Perl5 to run.