Posted on 2005-03-07 13:51:06-08 by b10m in response to 185
Re: Mail::DeliveryStatus::BounceParser Anybody?

Hi,

I've recently started to mess with this module too and found out that it didn't parse _all_ bounces well, but a fair enough deal for what I like to use it for.

I somehow wonder why your 'file size' seems to limit you to read the entire message. Bounces rarely get very big. If you want to parse an entire mailbox, I suggest using e.g. Mail::Box for that part, who throws the individual messages to this module. Maybe you could explain this?

Anyways, this sample code seemed to work for me (basically straight from the POD):

use Mail::DeliveryStatus::BounceParser; my $bounce = eval { Mail::DeliveryStatus::BounceParser->new ( \*STDIN ) }; if ( $@ ) { print "Whoa -- one we actually couldn't handle!\n" ; exit 255 ; } if($bounce->is_bounce) { foreach my $report ( $bounce->reports ) { print $bounce->orig_message_id; print $report->get('std_reason')."\n"; } } else { print "NO BOUNCE!\n"; }

And then,
perl whatever.pl < bounce.message

Direct Responses: 189 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.