On 06/04/2014 08:50 AM, Corey Edwards wrote:
2. Pipe the mail to a script on the server. It reads the message from STDIN.




I've used this route myself on a postfix server I added this to the alias file:




bugs:          "| /usr/local/bin/myscript.pl"

Then in the perl script I have this:

#!/usr/bin/perl
use Mail::MboxParser;
my $parseropts={enable_cache=>1,enable_grep=>1,cache_file_name => '/tmp/cache-file'}; my $mb=Mail::MboxParser->new(\*STDIN,decode=>'ALL',uudecode=>1,parseropts=>$parseropts);
for my $msg($mb->get_messages) {
    my $from=$msg->header->{from};
    my $subject=$msg->header->{subject};
    my $body=$msg->body($msg->find_body,0);
    my @body_lines = $body->as_lines;
}

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to