CC: | michael.stevens [...] dianomi.com, michael.smith [...] dianomi.com |
Subject: | Yet another spam case |
Yet another spam filter case.
Attached or in gitorious:
https://gitorious.org/mail-deliverystatus-bounceparser-fork/mail-
deliverystatus-bounceparser-
fork/commit/ee7b1e17709672c9667c2ca4798003adc71fa4ff
Subject: | 0001-bb-spam-filter-case.patch |
From ee7b1e17709672c9667c2ca4798003adc71fa4ff Mon Sep 17 00:00:00 2001
From: Michael Stevens <mstevens@etla.org>
Date: Tue, 13 Sep 2011 15:48:27 +0100
Subject: [PATCH] bb spam filter case
---
MANIFEST | 2 +
lib/Mail/DeliveryStatus/BounceParser.pm | 3 +-
t/corpus/spam-rejection21.msg | 92 +++++++++++++++++++++++++++++++
t/spam-rejection21.t | 29 ++++++++++
4 files changed, 125 insertions(+), 1 deletions(-)
create mode 100644 t/corpus/spam-rejection21.msg
create mode 100644 t/spam-rejection21.t
diff --git a/MANIFEST b/MANIFEST
index f7a5c4d..8069ee8 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -89,6 +89,7 @@ t/corpus/spam-rejection17.msg
t/corpus/spam-rejection18.msg
t/corpus/spam-rejection19.msg
t/corpus/spam-rejection20.msg
+t/corpus/spam-rejection21.msg
t/corpus/spam-rejection-uribl.msg
t/corpus/spam-with-badly-parsed-email.msg
t/corpus/spam-with-image.msg
@@ -163,6 +164,7 @@ t/spam-rejection17.t
t/spam-rejection18.t
t/spam-rejection19.t
t/spam-rejection20.t
+t/spam-rejection21.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 79f3313..d6059a6 100644
--- a/lib/Mail/DeliveryStatus/BounceParser.pm
+++ b/lib/Mail/DeliveryStatus/BounceParser.pm
@@ -1038,7 +1038,8 @@ sub _std_reason {
/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 or
- /accepted\s+due\s+to\s+spam\s+filter/i
+ /accepted\s+due\s+to\s+spam\s+filter/i or
+ /content\s+filter\s+rejection/i
) {
return "spam";
}
diff --git a/t/corpus/spam-rejection21.msg b/t/corpus/spam-rejection21.msg
new file mode 100644
index 0000000..e182e93
--- /dev/null
+++ b/t/corpus/spam-rejection21.msg
@@ -0,0 +1,92 @@
+Delivered-To: automated-bounces+7f927056-da33-11e0-b766-b42e2e334e9c@email.sample.com
+Received: by 10.231.35.202 with SMTP id q10cs23785ibd;
+ Thu, 8 Sep 2011 08:59:18 -0700 (PDT)
+Received: by 10.227.113.73 with SMTP id z9mr934843wbp.8.1315497557355;
+ Thu, 08 Sep 2011 08:59:17 -0700 (PDT)
+Return-Path: <>
+Received: from admin1.sample.co.uk (admin1.sample.co.uk [94.236.45.212])
+ by mx.google.com with ESMTP id b5si3902025wbh.103.2011.09.08.08.59.15;
+ Thu, 08 Sep 2011 08:59:16 -0700 (PDT)
+Received-SPF: pass (google.com: domain of admin1.sample.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.sample.co.uk designates 94.236.45.212 as permitted sender) smtp.mail=
+Received: by admin1.sample.co.uk (Postfix)
+ id A641D65102B; Thu, 8 Sep 2011 16:59:15 +0100 (BST)
+Date: Thu, 8 Sep 2011 16:59:15 +0100 (BST)
+From: MAILER-DAEMON@admin1.sample.co.uk (Mail Delivery System)
+Subject: Undelivered Mail Returned to Sender
+To: automated-bounces+7F927056-DA33-11E0-B766-B42E2E334E9C@email.sample.com
+Auto-Submitted: auto-replied
+MIME-Version: 1.0
+Content-Type: multipart/report; report-type=delivery-status;
+ boundary="F1C1A65102F.1315497555/admin1.sample.co.uk"
+Message-Id: <20110908155915.A641D65102B@admin1.sample.co.uk>
+
+This is a MIME-encapsulated message.
+
+--F1C1A65102F.1315497555/admin1.sample.co.uk
+Content-Description: Notification
+Content-Type: text/plain; charset=us-ascii
+
+This is the mail system at host admin1.sample.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@example.org.uk>: host ncmail2.sample3.com[205.139.105.11]
+ said: 554 5.7.1 Message cannot be accepted, content filter rejection
+ bbSpamReject>7.5 (in reply to end of DATA command)
+
+--F1C1A65102F.1315497555/admin1.sample.co.uk
+Content-Description: Delivery report
+Content-Type: message/delivery-status
+
+Reporting-MTA: dns; admin1.sample.co.uk
+X-Postfix-Queue-ID: F1C1A65102F
+X-Postfix-Sender: rfc822; automated-bounces+7F927056-DA33-11E0-B766-B42E2E334E9C@email.sample.com
+Arrival-Date: Thu, 8 Sep 2011 16:59:13 +0100 (BST)
+
+Final-Recipient: rfc822; john.smith@example.org.uk
+Action: failed
+Status: 5.7.1
+Remote-MTA: dns; ncmail2.sample3.com
+Diagnostic-Code: smtp; 554 5.7.1 Message cannot be accepted, content filter
+ rejection bbSpamReject>7.5
+
+--F1C1A65102F.1315497555/admin1.sample.co.uk
+Content-Description: Undelivered Message
+Content-Type: message/rfc822
+
+Received: by admin1.sample.co.uk (Postfix, from userid 505)
+ id F1C1A65102F; Thu, 8 Sep 2011 16:59:13 +0100 (BST)
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Content-Type: multipart/related; boundary="_----------=_131549755384674958"
+X-Mailer: MIME::Lite 3.027 (F2.78; T1.31; A2.07; B3.13; Q3.13)
+Date: Thu, 8 Sep 2011 16:59:13 +0100
+From: Fred Bloggs <fred.bloggs@email.sample.com>
+Subject: foo
+X-Campaignid: sample20100819.2
+List-Unsubscribe: <http://www.sampleoffers.co.uk/unsubscribe.epl?uuid=7F927056-DA33-11E0-B766-B42E2E334E9C>
+To: Thomas Loeffler <john.smith@example.org.uk>
+Message-Id: <20110908155913.F1C1A65102F@admin1.sample.co.uk>
+
+This is a multi-part message in MIME format.
+
+--_----------=_131549755384674958
+Content-Disposition: inline
+Content-Transfer-Encoding: quoted-printable
+Content-Type: text/html
+
+HTML goes here.
+
+--_----------=_131549755384674958--
+
+
+--F1C1A65102F.1315497555/admin1.sample.co.uk--
diff --git a/t/spam-rejection21.t b/t/spam-rejection21.t
new file mode 100644
index 0000000..29855f3
--- /dev/null
+++ b/t/spam-rejection21.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-rejection21.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