On Tue, Jul 17, 2007 at 06:37:29PM -0400, Ricardo SIGNES wrote: > 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?
I guess it depends what your use case is. If you're trying to process true failure DSNs, you probably don't care about autoresponders. If you're trying to keep administrivia off of a mailing list, you probably want to detect things like read-receipts, out-of-office replies, temporary failure warnings and the like. Maybe the solution is just to not call it BounceParser? # Create a parser. Don't load any plugins automatically. my $parser = Email::Classifier->new(); # Load the Email::Classifier::Plugin::Bounce plugin for catching # bounce messages $parser->add_classifier('Bounce'); # Load plugin for Out of Office replies $parser->add_classifier('Vacation'); # and hey, this would be nice too $parser->add_classifier('TemporaryDSN'); # Iterate over prioritized plugins and return first hit my $result = $parser->parse( $email_abstract ); # whine about it print "I got a " . $result->get_classification() . " from " . $result->get_sender() . " on message originally sent by " . $result->get_original_sender() . "\n"; Heck, if one wanted to be truly evil: my $parser = Email::Classifier->( classifiers => [ 'GPG' ], ); my $r = $parser->parse( $email_abstract ); if( $r->is_gpg_signed() ) { # let plugins provide new methods to # result object (inheritance? Sub::Exporter?) if( $r->valid_signature_by('0x12345678') ) { # Yes, we fully trust the message now eval $email_abstract->get_body(); } } Cheers, Dave
signature.asc
Description: Digital signature