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: 70897
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: Wishlist
Broken in: 1.527
Fixed in: (no value)



CC: michael.stevens [...] dianomi.com, michael.smith [...] dianomi.com
Subject: spam filter case
Yet another spam detection case. Patch attached or in gitorious: https://gitorious.org/mail-deliverystatus-bounceparser-fork/mail- deliverystatus-bounceparser- fork/commit/f2d3beeb70ee877409adb2aa92bb8afb949f1f06
Subject: 0001-new-spam-filter-bounce-case.patch
From f2d3beeb70ee877409adb2aa92bb8afb949f1f06 Mon Sep 17 00:00:00 2001 From: Michael Stevens <mstevens@etla.org> Date: Mon, 12 Sep 2011 14:13:00 +0100 Subject: [PATCH] new spam filter bounce case --- MANIFEST | 2 + lib/Mail/DeliveryStatus/BounceParser.pm | 3 +- t/corpus/spam-rejection20.msg | 91 +++++++++++++++++++++++++++++++ t/spam-rejection20.t | 29 ++++++++++ 4 files changed, 124 insertions(+), 1 deletions(-) create mode 100644 t/corpus/spam-rejection20.msg create mode 100644 t/spam-rejection20.t diff --git a/MANIFEST b/MANIFEST index 394cafe..f7a5c4d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -88,6 +88,7 @@ t/corpus/spam-rejection16.msg t/corpus/spam-rejection17.msg t/corpus/spam-rejection18.msg t/corpus/spam-rejection19.msg +t/corpus/spam-rejection20.msg t/corpus/spam-rejection-uribl.msg t/corpus/spam-with-badly-parsed-email.msg t/corpus/spam-with-image.msg @@ -161,6 +162,7 @@ t/spam-rejection16.t t/spam-rejection17.t t/spam-rejection18.t t/spam-rejection19.t +t/spam-rejection20.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 df79094..79f3313 100644 --- a/lib/Mail/DeliveryStatus/BounceParser.pm +++ b/lib/Mail/DeliveryStatus/BounceParser.pm @@ -1037,7 +1037,8 @@ sub _std_reason { /ESETS_SMTP\s+\(spam\)/i or /this\s+message\s+appears\s+to\s+be\s+spam/i or /Spam\s+score\s+\(\S+\)\s+too\s+high/i or - /matches\s+a\s+profile\s+the\s+Internet\s+community\s+may\s+consider\s+spam/i + /matches\s+a\s+profile\s+the\s+Internet\s+community\s+may\s+consider\s+spam/i or + /accepted\s+due\s+to\s+spam\s+filter/i ) { return "spam"; } diff --git a/t/corpus/spam-rejection20.msg b/t/corpus/spam-rejection20.msg new file mode 100644 index 0000000..a2c78e7 --- /dev/null +++ b/t/corpus/spam-rejection20.msg @@ -0,0 +1,91 @@ +Delivered-To: automated-bounces+eaf5972c-d88c-11e0-889e-a83de810887e@email.example.com +Received: by 10.231.35.202 with SMTP id q10cs79640ibd; + Tue, 6 Sep 2011 06:35:54 -0700 (PDT) +Received: by 10.216.180.82 with SMTP id i60mr899061wem.92.1315316153163; + Tue, 06 Sep 2011 06:35:53 -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 v21si6809197wec.41.2011.09.06.06.35.52; + Tue, 06 Sep 2011 06:35:53 -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 A45C165186A; Tue, 6 Sep 2011 14:35:52 +0100 (BST) +Date: Tue, 6 Sep 2011 14:35:52 +0100 (BST) +From: MAILER-DAEMON@admin1.example.co.uk (Mail Delivery System) +Subject: Undelivered Mail Returned to Sender +To: automated-bounces+EAF5972C-D88C-11E0-889E-A83DE810887E@email.example.com +Auto-Submitted: auto-replied +MIME-Version: 1.0 +Content-Type: multipart/report; report-type=delivery-status; + boundary="09E8A651865.1315316152/admin1.example.co.uk" +Message-Id: <20110906133552.A45C165186A@admin1.example.co.uk> + +This is a MIME-encapsulated message. + +--09E8A651865.1315316152/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 + +<sales@test.co.uk>: host mail.test2.net[217.194.212.245] said: 554 + Sending address not accepted due to spam filter (in reply to MAIL FROM + command) + +--09E8A651865.1315316152/admin1.example.co.uk +Content-Description: Delivery report +Content-Type: message/delivery-status + +Reporting-MTA: dns; admin1.example.co.uk +X-Postfix-Queue-ID: 09E8A651865 +X-Postfix-Sender: rfc822; automated-bounces+EAF5972C-D88C-11E0-889E-A83DE810887E@email.example.com +Arrival-Date: Tue, 6 Sep 2011 14:34:17 +0100 (BST) + +Final-Recipient: rfc822; sales@test.co.uk +Action: failed +Status: 5.0.0 +Remote-MTA: dns; mail.test2.net +Diagnostic-Code: smtp; 554 Sending address not accepted due to spam filter + +--09E8A651865.1315316152/admin1.example.co.uk +Content-Description: Undelivered Message +Content-Type: message/rfc822 + +Received: by admin1.example.co.uk (Postfix, from userid 505) + id 09E8A651865; Tue, 6 Sep 2011 14:34:17 +0100 (BST) +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: multipart/related; boundary="_----------=_131531605720931336" +X-Mailer: MIME::Lite 3.027 (F2.78; T1.31; A2.07; B3.13; Q3.13) +Date: Tue, 6 Sep 2011 14:34:17 +0100 +From: Fred Bloggs <fred.bloggs@email.example.com> +Subject: foo +X-Campaignid: example20100819.2 +List-Unsubscribe: <http://www.exampleoffers.co.uk/unsubscribe.epl?uuid=EAF5972C-D88C-11E0-889E-A83DE810887E> +To: john smith <sales@test.co.uk> +Message-Id: <20110906133417.09E8A651865@admin1.example.co.uk> + +This is a multi-part message in MIME format. + +--_----------=_131531605720931336 +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable +Content-Type: text/html + +HTML + +--_----------=_131531605720931336-- + + +--09E8A651865.1315316152/admin1.example.co.uk-- diff --git a/t/spam-rejection20.t b/t/spam-rejection20.t new file mode 100644 index 0000000..025ef34 --- /dev/null +++ b/t/spam-rejection20.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-rejection20.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.4.1