I'm not sure how many of you have used "the BounceParser."  We use it
extensively at work, and speak of it only in hushed tones -- or, if we're sure
it can't hear us, we proclaim its wickedness loudly, dreaming of a day when we
can be free of it.  In the meantime, though, we suffer through its horrible
reign of terror.

Mail::DeliveryStatus::BounceParser sucks.  If you don't already know this, here
is a primer on what to hate:

  * MDSBP->new($input) either returns a BounceParser object or false
  * the BounceParser object represents a bounce, not a parser
  * and that's why you can call it as ->parse, now, too
  * hey, it's 400 lines long, so maybe it deserves two names
  * if it returns false, you still might not have a bounce
  * falsity means "we're sure it's not a bounce"
  * an object means "it might be a bounce, but check ->is_bounce"
  * a true result from is_bounce means we're sure it IS a bounce
  * an ideal bounce is an RFC1892 message
  * other messages are s///d to look more like RFC1892 before parsing
  * a bounce has many reports
  * you can get report data with, for example, $bounce->addresses
  * but don't try $report->addresses, that doesn't work
  * reports have std_reason fields, explaining WHY the message bounced
  * one of these is standard reasons is "no_problemo"
  * not one of them is "spam" or "blacklisted"
  * go look at the source

After all that, it just doesn't work very well, either.

I want a good bounce parser for two main reasons:

  1. Recognize bouncing mailing list subscribers so they can be booted.
  2. Recognize bounces that say that my MXes are being blocked so I can
     address the situation.

I'm not sure what this system needs to look like, but from 1,000 feet up, the
BounceParser isn't totally wrong.

  my $bounce = $parser->parse($email_abstract);

  my $remote  = $bounce->bounced_by;
  my $local   = $bounce->originally_sent_by;
  my @reports = $bounce->reports; # may be ()

  my $reason = $report->bounce_reason; # one of a fixed list
  my @addrs  = $report->bounced_to;

I don't see any reason for this to notice autoresponders at all.  If we can
tell they're not bounces, there's no reason to report them, is there?

The parse method probably does something like:

  for my $plugin (@prioritized_list) {
    return $plugin->parse($message) if $plugin->can_parse($message);
  }

  return;

Have I been twisted and blinded by The BounceParser?  Is there a significantly
better way to design this?

I have a few million bounce messages sitting in an archive, just waiting to
become test cases.

-- 
rjbs

Reply via email to