This is what Mail::Audit is all about:
NAME
Mail::Audit - Library for creating easy mail filters
SYNOPSIS
use Mail::Audit;
my $mail = Mail::Audit->new;
$mail->pipe("listgate p5p") if ($mail->from =~ /perl5-porters/);
$mail->accept("perl) if ($mail->from =~ /perl/);
$mail->reject("We do not accept spam") if looks_like_spam($mail);
$mail->ignore if $mail->subject =~ /boring/i;
...
DESCRIPTION
procmail is nasty. It has a tortuous and complicated recipe
format, and I don't like it. I wanted something flexible whereby I could
filter my mail using Perl tests.
`Mail::Audit' was inspired by Tom Christiansen's audit_mail and
deliverlib programs. It allows a piece of email to be logged, examined,
accepted into a mailbox, filtered, resent elsewhere, rejected, and so
on. It's designed to allow you to easily create filter programs to stick
in a .forward file or similar.
POPREAD
Why should you use popread? POP3 mailboxes can collect lots of messages,
which you then download, all at once. And every time your local delivery
agent tries to deliver each message through your .forward or .qmail, it
has to fork off a new copy of Perl, which has to load up Mail::Audit and
its dependent modules, and so on. When you're downloading 100 messages,
this can drive your load average through the roof.
popread takes care of POP access, filtering and local delivery all in
one process, which is much faster and more efficient. Oh, and it deletes
duplicate mail from the POP3 server, so you're not downloading the same
message over and over again (Think a message to a mailing list, Cc'd to
you) saving you bandwidth too.
You don't have to use popread, but if you do, it requires the
Mail::POP3Client module from CPAN. Remember to add your filter code to
it, and set up your POP3 accounts, before attempting to run the program.
PROC2MA
This is a very early version of a program which automatically converts
your legacy procmail rc files into Mail::Audit filters. Don't expect it
to work flawlessly on complex rcs. If you want to use it, you need the
Parse::RecDescent module from CPAN.
BUG FIXES AND SUGGESTIONS
I heartily welcome bug fixes, suggestions and patches to Mail::Audit.
Please mail them to me at simon@cpan.org. Also, please feel free to mail
me if you'd like to informed about future versions of Mail::Audit, or if
you have any problems with the module.
Simon