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

People
Owner: Nobody in particular
Requestors: MSTEVENS [...] cpan.org
Cc: michael.smith [...] dianomi.com
michael.stevens [...] dianomi.com
AdminCc:

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



CC: michael.stevens [...] dianomi.com, michael.smith [...] dianomi.com
Subject: Yet another spam case
Yet another spam case. Patch attached or in gitorious.
Subject: 0001-Yet-another-spam-case.patch
From 0c87d3fe46ddc427778b144603c68071ec0689d1 Mon Sep 17 00:00:00 2001 From: Michael Stevens <mstevens@etla.org> Date: Mon, 24 Oct 2011 17:21:27 +0100 Subject: [PATCH] Yet another spam case. --- MANIFEST | 2 + lib/Mail/DeliveryStatus/BounceParser.pm | 3 +- t/corpus/spam-rejection25.msg | 103 +++++++++++++++++++++++++++++++ t/spam-rejection25.t | 29 +++++++++ 4 files changed, 136 insertions(+), 1 deletions(-) create mode 100644 t/corpus/spam-rejection25.msg create mode 100644 t/spam-rejection25.t diff --git a/MANIFEST b/MANIFEST index f504931..81bcdc1 100644 --- a/MANIFEST +++ b/MANIFEST @@ -93,6 +93,7 @@ t/corpus/spam-rejection21.msg t/corpus/spam-rejection22.msg t/corpus/spam-rejection23.msg t/corpus/spam-rejection24.msg +t/corpus/spam-rejection25.msg t/corpus/spam-rejection-uribl.msg t/corpus/spam-with-badly-parsed-email.msg t/corpus/spam-with-image.msg @@ -171,6 +172,7 @@ t/spam-rejection21.t t/spam-rejection22.t t/spam-rejection23.t t/spam-rejection24.t +t/spam-rejection25.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 c120d90..0b30885 100644 --- a/lib/Mail/DeliveryStatus/BounceParser.pm +++ b/lib/Mail/DeliveryStatus/BounceParser.pm @@ -1042,7 +1042,8 @@ sub _std_reason { /content\s+filter\s+rejection/i or /using\s+a\s+mass\s+mailer/i or /Spam\s+email/i or - /Spam\s+content\s+matched/i + /Spam\s+content\s+matched/i or + (/CONTENT\s+REJECT/i and /dspam\s+check/i) ) { return "spam"; } diff --git a/t/corpus/spam-rejection25.msg b/t/corpus/spam-rejection25.msg new file mode 100644 index 0000000..2e3941e --- /dev/null +++ b/t/corpus/spam-rejection25.msg @@ -0,0 +1,103 @@ +Delivered-To: automated-bounces+fe3a4824-f299-11e0-af66-f4ecf5691d73@email.example.com +Received: by 10.180.105.100 with SMTP id gl4cs83417wib; + Sun, 9 Oct 2011 10:40:42 -0700 (PDT) +Received: by 10.216.221.135 with SMTP id r7mr5596434wep.45.1318182041964; + Sun, 09 Oct 2011 10:40:41 -0700 (PDT) +Return-Path: <> +Received: from admin1.example.co.uk (admin1.example.co.uk. [94.236.45.212]) + by mx.google.com with ESMTP id x17si11536394weq.66.2011.10.09.10.40.41; + Sun, 09 Oct 2011 10:40:41 -0700 (PDT) +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 8F7E06510AF; Sun, 9 Oct 2011 18:40:41 +0100 (BST) +Date: Sun, 9 Oct 2011 18:40:41 +0100 (BST) +From: MAILER-DAEMON@admin1.example.co.uk (Mail Delivery System) +Subject: Undelivered Mail Returned to Sender +To: automated-bounces+FE3A4824-F299-11E0-AF66-F4ECF5691D73@email.example.com +Auto-Submitted: auto-replied +MIME-Version: 1.0 +Content-Type: multipart/report; report-type=delivery-status; + boundary="2C2786510C8.1318182041/admin1.example.co.uk" +Content-Transfer-Encoding: 8bit +Message-Id: <20111009174041.8F7E06510AF@admin1.example.co.uk> + +This is a MIME-encapsulated message. + +--2C2786510C8.1318182041/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.g@test.com>: host testmx1.test.com[61.135.132.110] said: 553 5.7.3 + CONTENT REJECT:192.168.95.162.2011101001.XXYIvtHf:dspam + check:4:http://mail.test.com/info/policy/12 (in reply to end of DATA + command) + +--2C2786510C8.1318182041/admin1.example.co.uk +Content-Description: Delivery report +Content-Type: message/delivery-status + +Reporting-MTA: dns; admin1.example.co.uk +X-Postfix-Queue-ID: 2C2786510C8 +X-Postfix-Sender: rfc822; automated-bounces+FE3A4824-F299-11E0-AF66-F4ECF5691D73@email.example.com +Arrival-Date: Sun, 9 Oct 2011 18:13:23 +0100 (BST) + +Final-Recipient: rfc822; john.smith.g@test.com +Action: failed +Status: 5.7.3 +Remote-MTA: dns; testmx1.test.com +Diagnostic-Code: smtp; 553 5.7.3 CONTENT + REJECT:192.168.95.162.2011101001.XXYIvtHf:dspam + check:4:http://mail.test.com/info/policy/12 + +--2C2786510C8.1318182041/admin1.example.co.uk +Content-Description: Undelivered Message +Content-Type: message/rfc822 +Content-Transfer-Encoding: 8bit + +Received: by admin1.example.co.uk (Postfix, from userid 507) + id 2C2786510C8; Sun, 9 Oct 2011 18:13:23 +0100 (BST) +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: multipart/alternative; boundary="_----------=_131818040318075154" +X-Mailer: MIME::Lite 3.027 (F2.78; T1.31; A2.07; B3.13; Q3.13) +Date: Sun, 9 Oct 2011 18:13:23 +0100 +From: Fred Bloggs <fred.bloggs@email.example.com> +Subject: foo +X-Campaignid: example20110704.1 +List-Unsubscribe: <http://www.exampleoffers.co.uk/unsubscribe.epl?uuid=FE3A4824-F299-11E0-AF66-F4ECF5691D73> +To: john smith <john.smith.g@test.com> +Message-Id: <20111009171323.2C2786510C8@admin1.example.co.uk> + +This is a multi-part message in MIME format. + +--_----------=_131818040318075154 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain + +Text + +--_----------=_131818040318075154 +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable +Content-Type: text/html + +HTML + +--_----------=_131818040318075154-- + + +--2C2786510C8.1318182041/admin1.example.co.uk-- diff --git a/t/spam-rejection25.t b/t/spam-rejection25.t new file mode 100644 index 0000000..2fcf33d --- /dev/null +++ b/t/spam-rejection25.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-rejection25.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.5.4