Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Mail-DeliveryStatus-BounceParser CPAN distribution.

Report information
The Basics
Id: 51495
Status: resolved
Priority: 0/
Queue: Mail-DeliveryStatus-BounceParser

People
Owner: Nobody in particular
Requestors: MSTEVENS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.520
Fixed in: (no value)



Subject: proposed enhancement to reason field
Proposed improvement to reporting of reason field. I've also emailed this to a few people who seemed to be the maintainer, but I was having trouble finding the right person so I've attached it here too.
Subject: bounceparser.diff
diff -urN Mail-DeliveryStatus-BounceParser-1.520/lib/Mail/DeliveryStatus/BounceParser.pm ../Mail-DeliveryStatus-BounceParser-1.520/lib/Mail/DeliveryStatus/BounceParser.pm --- Mail-DeliveryStatus-BounceParser-1.520/lib/Mail/DeliveryStatus/BounceParser.pm 2009-01-16 03:31:36.000000000 +0000 +++ ../Mail-DeliveryStatus-BounceParser-1.520/lib/Mail/DeliveryStatus/BounceParser.pm 2009-11-13 12:02:00.000000000 +0000 @@ -308,7 +308,6 @@ $self->log("couldn't find original message id."); } - # # try to extract email addresses to identify members. # we will also try to extract reasons as much as we can. @@ -580,10 +579,14 @@ ne "unknown" and $std_reason eq "unknown" ); + my $reason = $split[$i-1]; + $reason =~ s/(.*?). (Your mail to the following recipients could not be delivered)/$2/; + $by_email{$email} = { email => $email, raw => join ("", @split[$i-1..$i+1]), std_reason => $std_reason, + reason => $reason }; } diff -urN Mail-DeliveryStatus-BounceParser-1.520/t/aol-attachment.t ../Mail-DeliveryStatus-BounceParser-1.520/t/aol-attachment.t --- Mail-DeliveryStatus-BounceParser-1.520/t/aol-attachment.t 1970-01-01 01:00:00.000000000 +0100 +++ ../Mail-DeliveryStatus-BounceParser-1.520/t/aol-attachment.t 2009-11-13 12:09:26.000000000 +0000 @@ -0,0 +1,39 @@ +#!perl -wT +use strict; + +use Test::More tests => 4; + +use Mail::DeliveryStatus::BounceParser; +use Data::Dumper; + +# Test parsing AOL "recipient not accepting attachment" messages + +# FH because we're being backcompat to pre-lexical +sub readfile { + my $fn = shift; + open FH, "$fn" or die $!; + local $/; + my $text = <FH>; + close FH; + return $text; +} + +my $message = readfile('t/corpus/aol.attachment.msg'); + +my $bounce = Mail::DeliveryStatus::BounceParser->new($message); + +isa_ok($bounce, 'Mail::DeliveryStatus::BounceParser'); + +ok($bounce->is_bounce, "it's a bounce, alright"); + +my ($report) = $bounce->reports; + +is_deeply( + [ $bounce->addresses ], + [ 'exampleuser@aol.com' ], + "We've got the right address", +); + +my $reason = $report->get("reason"); + +is($reason, "Your mail to the following recipients could not be delivered because they are not accepting mail with attachments or embedded images:", "reason is right"); diff -urN Mail-DeliveryStatus-BounceParser-1.520/t/corpus/aol.attachment.msg ../Mail-DeliveryStatus-BounceParser-1.520/t/corpus/aol.attachment.msg --- Mail-DeliveryStatus-BounceParser-1.520/t/corpus/aol.attachment.msg 1970-01-01 01:00:00.000000000 +0100 +++ ../Mail-DeliveryStatus-BounceParser-1.520/t/corpus/aol.attachment.msg 2009-11-13 12:10:03.000000000 +0000 @@ -0,0 +1,23 @@ +Delivered-To: automated-bounces@example.com +Received: by 10.204.119.15 with SMTP id x15cs341259bkq; + Wed, 14 Oct 2009 02:42:35 -0700 (PDT) +Received: by 10.220.79.9 with SMTP id n9mr12559077vck.4.1255513352794; + Wed, 14 Oct 2009 02:42:32 -0700 (PDT) +Return-Path: <> +Received: from omr-d25.mx.aol.com (omr-d25.mx.aol.com [205.188.249.69]) + by mx.google.com with ESMTP id 37si4805656vws.126.2009.10.14.02.42.32; + Wed, 14 Oct 2009 02:42:32 -0700 (PDT) +Received-SPF: pass (google.com: best guess record for domain of omr-d25.mx.aol.com designates 205.188.249.69 as permitted sender) client-ip=205.188.249.69; +Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of omr-d25.mx.aol.com designates 205.188.249.69 as permitted sender) smtp.mail= +Received: from air-de07.mail.aol.com (air-de07.mail.aol.com [172.19.170.135]) by omr-d25.mx.aol.com (v117.7) with ESMTP id MAILOMRD251-7d834ad59cf32db; Wed, 14 Oct 2009 05:42:11 -0400 +from: Mail Delivery Subsystem <MAILER-DAEMON@aol.com> +Date: Wed, 14 Oct 2009 05:38:51 EDT +To: <automated-bounces@example.com> +Subject: Mail Delivery Problem +Mailer: AIRmail [v125.7] +X-AOL-IP: 172.19.170.135 +Message-ID: <foo@omr-d25.mx.aol.com> + + +Sorry automated-bounces@example.com. Your mail to the following recipients could not be delivered because they are not accepting mail with attachments or embedded images: + exampleuser diff -urN Mail-DeliveryStatus-BounceParser-1.520/t/various-unknown.t ../Mail-DeliveryStatus-BounceParser-1.520/t/various-unknown.t --- Mail-DeliveryStatus-BounceParser-1.520/t/various-unknown.t 2008-11-21 21:37:28.000000000 +0000 +++ ../Mail-DeliveryStatus-BounceParser-1.520/t/various-unknown.t 2009-11-13 12:08:40.000000000 +0000 @@ -63,7 +63,13 @@ "domino.unknown.msg" => { # TODO = should return actual code / reason "reason" => - '', + 'Your message + + Subject: Test Bounce + +was not delivered to: + + ', "smtp_code" => '', }, "aol.unknown.msg" => { @@ -74,7 +80,9 @@ "qmail.unknown.msg" => { # TODO = should return actual code / reason "reason" => - '', + "Hi. This is the qmail-send program at mail1.coqui.net. +I'm afraid I wasn't able to deliver your message to the following addresses. +This is a permanent error; I've given up. Sorry it didn't work out.", "smtp_code" => '', }, "exchange.unknown.msg" => { @@ -86,7 +94,7 @@ "novell-with-rhs.msg" => { # TODO = should (maybe) return actual reason "reason" => - '', + 'The message that you sent was undeliverable to the following:', # Can't really get this since it DNE "smtp_code" => '', },
Subject: Re: [rt.cpan.org #51495] proposed enhancement to reason field
Date: Fri, 13 Nov 2009 08:48:22 -0500
To: Michael Stevens via RT <bug-Mail-DeliveryStatus-BounceParser [...] rt.cpan.org>
From: Ricardo Signes <rjbs [...] cpan.org>
* Michael Stevens via RT <bug-Mail-DeliveryStatus-BounceParser@rt.cpan.org> [2009-11-13T08:35:42] Show quoted text
> > Proposed improvement to reporting of reason field. > > I've also emailed this to a few people who seemed to be the maintainer, > but I was having trouble finding the right person so I've attached it > here too.
Thanks, I'll have a look at the patch. -- rjbs
Subject: Re: [rt.cpan.org #51495] proposed enhancement to reason field
Date: Fri, 13 Nov 2009 13:51:37 +0000
To: Ricardo SIGNES via RT <bug-Mail-DeliveryStatus-BounceParser [...] rt.cpan.org>
From: Michael Stevens <mstevens [...] etla.org>
On Fri, Nov 13, 2009 at 08:48:45AM -0500, Ricardo SIGNES via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=51495 > > > * Michael Stevens via RT <bug-Mail-DeliveryStatus-BounceParser@rt.cpan.org> [2009-11-13T08:35:42]
> > > > Proposed improvement to reporting of reason field. > > > > I've also emailed this to a few people who seemed to be the maintainer, > > but I was having trouble finding the right person so I've attached it > > here too.
> > Thanks, I'll have a look at the patch.
I'm not sure if it's "perfect BounceParser style" but it's hopefully worth a look. Michael
merged -- rjbs