Thread

Posted on Mon Mar 7 13:10:24 2005 by softbaked
Mail::DeliveryStatus::BounceParser Anybody?
Hi, I'm having trouble understanding how to get Mail::DeliveryStatus::BounceParser to work. this is the synopsis:

my $bounce = Mail::DeliveryStatus::BounceParser->new( \*STDIN | $fh | "entire\nmessage" |"array","o +f","lines"] )

I can't use the "entire\nmessage" or ["array","of","lines"] because of the file size and if I feed it STDIN or a file handle I get nothing...., any thoughts would be appreciated.

Link to module

Direct Responses: 187 | Write a response
Posted on Mon Mar 7 15:51:06 2005 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
Posted on Tue Mar 8 19:59:58 2005 by softbaked in response to 187
Re: Mail::DeliveryStatus::BounceParser Anybody?
Thanks for the reply, I had no problem processing individual bounces, and I was using similar code to what you posted above, the problem I was having was trying to process an entire mailbox which had collected over 10,000 bounces. Your suggestion to use something like 'Mail::Box' cleared things up for me ( I ended up using Mail::MboxParser ) which allowed me to feed it one message at a time, thanks again.

Just like you I noticed that it did not parse _all_ bounces well, in most situations this would have been fine for my purpose but I needed near 100% accuracy this time so instead I ended up using bBounce it's $9.95 a month but if you have a large maillist it's priceless, I'm very happy with the service.
Write a response