The synopsis of Mail::DeliveryStatus::BounceParser tells me that it wants each mail fed to it separately. As you have a file in mbox format containing several mails, you'll have to split up that file first, and then pass the single mails to Mail::DeliveryStatus::BounceParser like this, according to the synopsis:

use strict; use Mail::DeliveryStatus::BounceParser; my $mail; # current mail while (<>) { if (/^From:/ && $mail) { my $bounce = eval { Mail::DeliveryStatus::BounceParser->new( $mail + ) }; if ($@) { warn "Got error from M::DS::BP: $@ while parsing input" } else { my @addresses = $bounce->addresses; my @reports = $bounce->reports; my $orig_message_id = $bounce->orig_message_id; my $orig_message = $bounce->orig_message; print "Got bounce for $orig_message_id (@reports)"; }; $mail = ""; }; $mail .= $_; }

That's all there is to it. The code is untested but should work like that.


In reply to Re^4: Detecting bounced mails by Corion
in thread Detecting bounced mails by Corion

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.