in reply to [Module recommendation ] parsing incoming email (piped to a script)

I can't comment on the efficiency of it in a high-volume environment, but I've been using Mail::Box, and its handy Mail::Message class to parse out a messages coming from a procmail script. It's very versatile in dealing with encodings, attachments, etc. and that versatility has been worth the inefficiency of such a heavy object for my purposes. Here's a snippet from my script:

#!/usr/bin/perl -w use strict; use Mail::Message; <>; # toss the mbox format From line my $msg = Mail::Message->read(\*STDIN); # (process the message) # write it back to STDOUT print $msg->head->createFromLine; $msg->print; exit;

-xdg

Code posted by xdg on PerlMonks is public domain. It has no warranties, express or implied. Posted code may not have been tested. Use at your own risk.

  • Comment on Re: [Module recommendation ] parsing incoming email (piped to a script)
  • Download Code