NAME
Mail::Graph - draw graphical stats for mails/spams
SYNOPSIS
use Mail::Graph;
$graph = Mail::Graph->new( items => 'spam',
output => 'spams/',
input => '~/Mail/spam/',
);
$graph->generate();
DESCRIPTION
This module parses mailbox files in either compressed or uncompressed form and then generates pretty statistics and graphs about them. Although at first developed to do spam statistics, it works just fine for normal mail.
File Format
The module reads in files in mbox format. These can be compressed by gzip, or just plain text. Since the module read in any files that are in one directory, it can also handle mail-dir style folders, e.g. a directory where each mail resides in an extra file.
The file format is quite simple and looks like this:
From sample_foo@example.com Tue Oct 27 18:38:52 1998
Received: from barfel by foo.example.com (8.9.1/8.6.12)
From: forged_bar@example.com
X-Envelope-To: <sample_foo@example.com>
Date: Tue, 27 Oct 1998 09:52:14 +0100 (CET)
Message-Id: <199810270852.12345567@example.com>
To: <none@example.com>
Subject: Sorry...
X-Loop-Detect: 1
X-Spamblock: caught by rule dummy@
This is a sample spam
Basically, an email header plus email body, separated by the From
lines.
The following fields are examined to determine:
X-Envelope-To the target address/domain
From address@domain the sender
From date the receiving date
METHODS
new()
Create a new Mail::Graph object.
The following options exist:
input Path to an directory containing mbox files
Alternatively, name of an mbox file
output Path where to write the output stats
items Try 'spams' or 'mails' (can be any string)
generate hash with names of stats to generate (1=on, 0=off):
month per each month of the year
day per each day of the month
dow per each day of the week
yearly per year
daily per each day (with average)
monthtly per each month
toplevel per top_level domain
rule per filter rule that matched
target per target address
domain per target domain
las_x_days items for each of the last x days
set it to the number of days you want
average set to 0 to disable, otherwise it gives the number
of days/weeks/month to average over
average_days if not set, uses average, 0 to disable
average_months if not set, uses average, 0 to disable
average_weeks if not set, uses average, 0 to disable
height height of the generated images
template name of the template file (ending in .tpl) that is
used to generate the html output, e.g. 'index.tpl'
generate()
Generate the stats, fill in the template and write it out. Takes no options.
error()
Return an error message or undef for no error.
BUGS
None known so far.
LICENSE
This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
(c) by Tels http://bloodgate.com/ 2002.