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: 72775
Status: resolved
Priority: 0/
Queue: Mail-DeliveryStatus-BounceParser

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

Bug Information
Severity: (no value)
Broken in: 1.527
Fixed in: (no value)



Subject: another spam case
another spam case Patch attached or in gitorious.
Subject: 0001-new-spam-case.patch
From 39ab38dab8a72fc427a76ed30cff852b1532cd5b Mon Sep 17 00:00:00 2001 From: Michael Stevens <mstevens@etla.org> Date: Mon, 28 Nov 2011 14:23:20 +0000 Subject: [PATCH] new spam case --- MANIFEST | 2 + lib/Mail/DeliveryStatus/BounceParser.pm | 3 +- t/corpus/spam-rejection26.msg | 92 +++++++++++++++++++++++++++++++ t/spam-rejection26.t | 29 ++++++++++ 4 files changed, 125 insertions(+), 1 deletions(-) create mode 100644 t/corpus/spam-rejection26.msg create mode 100644 t/spam-rejection26.t diff --git a/MANIFEST b/MANIFEST index b8fbafc..4d8ba0e 100644 --- a/MANIFEST +++ b/MANIFEST @@ -95,6 +95,7 @@ t/corpus/spam-rejection22.msg t/corpus/spam-rejection23.msg t/corpus/spam-rejection24.msg t/corpus/spam-rejection25.msg +t/corpus/spam-rejection26.msg t/corpus/spam-rejection-uribl.msg t/corpus/spam-with-badly-parsed-email.msg t/corpus/spam-with-image.msg @@ -175,6 +176,7 @@ t/spam-rejection22.t t/spam-rejection23.t t/spam-rejection24.t t/spam-rejection25.t +t/spam-rejection26.t t/spam-rejection-uribl.t t/spam-with-image.t t/spamassassin.t diff --git a/lib/Mail/DeliveryStatus/BounceParser.pm b/lib/Mail/DeliveryStatus/BounceParser.pm index 092e145..52d13b1 100644 --- a/lib/Mail/DeliveryStatus/BounceParser.pm +++ b/lib/Mail/DeliveryStatus/BounceParser.pm @@ -1042,7 +1042,8 @@ sub _std_reason { /using\s+a\s+mass\s+mailer/i or /Spam\s+email/i or /Spam\s+content\s+matched/i or - (/CONTENT\s+REJECT/i and /dspam\s+check/i) + (/CONTENT\s+REJECT/i and /dspam\s+check/i) or + /this\s+email\s+is\s+spam/i ) { return "spam"; } diff --git a/t/corpus/spam-rejection26.msg b/t/corpus/spam-rejection26.msg new file mode 100644 index 0000000..3446fc1 --- /dev/null +++ b/t/corpus/spam-rejection26.msg @@ -0,0 +1,92 @@ +Delivered-To: automated-bounces+a11c5b3a-0d17-11e1-b000-f58545dae3e1@email.example.com +Received: by 10.142.14.1 with SMTP id 1cs69187wfn; + Sat, 12 Nov 2011 02:18:23 -0800 (PST) +Received: by 10.227.60.85 with SMTP id o21mr10614767wbh.0.1321093101065; + Sat, 12 Nov 2011 02:18:21 -0800 (PST) +Return-Path: <> +Received: from admin1.example.co.uk (admin1.example.co.uk. [94.236.45.212]) + by mx.google.com with ESMTP id fw12si5987825wbb.92.2011.11.12.02.18.20; + Sat, 12 Nov 2011 02:18:21 -0800 (PST) +Received-SPF: pass (google.com: domain of admin1.example.co.uk designates 94.236.45.212 as permitted sender) client-ip=94.236.45.212; +Authentication-Results: mx.google.com; spf=pass (google.com: domain of admin1.example.co.uk designates 94.236.45.212 as permitted sender) smtp.mail= +Received: by admin1.example.co.uk (Postfix) + id 5242A651267; Sat, 12 Nov 2011 10:18:20 +0000 (GMT) +Date: Sat, 12 Nov 2011 10:18:20 +0000 (GMT) +From: MAILER-DAEMON@admin1.example.co.uk (Mail Delivery System) +Subject: Undelivered Mail Returned to Sender +To: automated-bounces+A11C5B3A-0D17-11E1-B000-F58545DAE3E1@email.example.com +Auto-Submitted: auto-replied +MIME-Version: 1.0 +Content-Type: multipart/report; report-type=delivery-status; + boundary="9F69C651125.1321093100/admin1.example.co.uk" +Message-Id: <20111112101820.5242A651267@admin1.example.co.uk> + +This is a MIME-encapsulated message. + +--9F69C651125.1321093100/admin1.example.co.uk +Content-Description: Notification +Content-Type: text/plain; charset=us-ascii + +This is the mail system at host admin1.example.co.uk. + +I'm sorry to have to inform you that your message could not +be delivered to one or more recipients. It's attached below. + +For further assistance, please send mail to <postmaster> + +If you do so, please include this problem report. You can +delete your own text from the attached returned message. + + The mail system + +<john.smith@sample.com>: host mail.sample.com[74.219.101.83] said: + 550 5.7.1 Sorry, our email server thinks this email is spam (in reply to + end of DATA command) + +--9F69C651125.1321093100/admin1.example.co.uk +Content-Description: Delivery report +Content-Type: message/delivery-status + +Reporting-MTA: dns; admin1.example.co.uk +X-Postfix-Queue-ID: 9F69C651125 +X-Postfix-Sender: rfc822; automated-bounces+A11C5B3A-0D17-11E1-B000-F58545DAE3E1@email.example.com +Arrival-Date: Sat, 12 Nov 2011 10:18:13 +0000 (GMT) + +Final-Recipient: rfc822; john.smith@sample.com +Action: failed +Status: 5.7.1 +Remote-MTA: dns; mail.sample.com +Diagnostic-Code: smtp; 550 5.7.1 Sorry, our email server thinks this email is + spam + +--9F69C651125.1321093100/admin1.example.co.uk +Content-Description: Undelivered Message +Content-Type: message/rfc822 + +Received: by admin1.example.co.uk (Postfix, from userid 507) + id 9F69C651125; Sat, 12 Nov 2011 10:18:13 +0000 (GMT) +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: multipart/related; boundary="_----------=_1321093093802311" +X-Mailer: MIME::Lite 3.027 (F2.78; T1.31; A2.07; B3.13; Q3.13) +Date: Sat, 12 Nov 2011 10:18:13 +0000 +From: Fred Bloggs <fred.bloggs@email.example.com> +Subject: foo +X-Campaignid: example20100819.2 +List-Unsubscribe: <http://www.exampleoffers.co.uk/unsubscribe.epl?uuid=A11C5B3A-0D17-11E1-B000-F58545DAE3E1> +To: John Smith <john.smith@sample.com> +Message-Id: <20111112101813.9F69C651125@admin1.example.co.uk> + +This is a multi-part message in MIME format. + +--_----------=_1321093093802311 +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable +Content-Type: text/html + +test + +--_----------=_1321093093802311-- + + +--9F69C651125.1321093100/admin1.example.co.uk-- diff --git a/t/spam-rejection26.t b/t/spam-rejection26.t new file mode 100644 index 0000000..d58eaec --- /dev/null +++ b/t/spam-rejection26.t @@ -0,0 +1,29 @@ +#!perl -wT +use strict; + +use Test::More tests => 3; + +use Mail::DeliveryStatus::BounceParser; + +# 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/spam-rejection26.msg'); + +my $bounce = Mail::DeliveryStatus::BounceParser->new($message); + +isa_ok($bounce, 'Mail::DeliveryStatus::BounceParser'); +ok($bounce->is_bounce, "This is a bounce"); + +my ($report) = $bounce->reports; + +my $std_reason = $report->get("std_reason"); + +is($std_reason, "spam", "std reason is spam"); -- 1.7.2.5