Back to procmail

By Abhijit Menon-Sen <>

When I first started receiving more email than I could deal with in my inbox, I reluctantly cobbled together a .procmailrc from bits of other people's configuration files. procmail was a mystery, but my needs were simple, and although I never graduated to liking its syntax, I learned to get along with it reasonably well over time.

Then I read Simon Cozens' article about Mail filtering with Mail::Audit, and I was delighted by the thought of writing a clear and understandable Perl program (ha!) to sort email. I had switched away from procmail to a simple Mail::Audit script almost before I had reached the end of the article.

My little program was convenient. Rather than having a separate recipe for each mailing list, the code would derive the mailbox name from the List-Id or Mailing-List header field. (For all I know, procmail may be able to do this too, but none of the examples show how to do it, and I never tried very hard to figure it out.) That code kept me happy for almost ten years.

Yesterday, I installed Ubuntu 11.04, which ships with Perl 5.10.1; by coincidence, the official end of support for Perl 5.10 was announced a day earlier, along with the release of Perl 5.14. I decided to leave the system Perl alone, and use perlbrew to maintain my own Perl installation. But I knew that would take hours with my reduced bandwidth, and I didn't want to wait until then to read my mail.

So I had the bright idea of installing Mail::Audit in ~/perl just to be able to run my mail filter. I downloaded Mail-Audit-2.225.tar.gz from a CPAN mirror and ran Makefile.PL, only to be warned that File::HomeDir, File::Tempdir, and MIME::Entity were missing. I tried to install using the system, only to find still more dependencies: Test::Tester, File::Which, Test::NoWarnings, Test::Script, Probe::Perl, MIME-tools, IPC::Run3, and Test::Deep. Something amongst that collection failed to install, and I was left looking at several screenfuls of failing tests.

Do I understand that the use of File::HomeDir and IPC::Run3 probably allows users of Windows and VMS to use Mail::Audit? Yes. Am I glad that all of these modules have comprehensive test suites? Yes. Could I have fixed the problem? Sure, if I had spent some time investigating. But my newly-installed gnome-terminal wouldn't scroll back far enough, and I suddenly remembered that procmail, inscrutable as always, was already installed.

Ten minutes and some regex-surgery on my filter script later, I had cobbled together enough of a .procmailrc to begin reading my mail.

(I'm not overly fond of CPAN dependencies, but this post is about my mail filter growing into something that demanded more attention than procmail, not about Mail::Audit having too many dependencies per se. For comparison, I am a reasonably happy user of Email::Stuff in some of my apps, and that has even more dependencies.)