CC: | michael.stevens [...] dianomi.com, michael.smith [...] dianomi.com |
Subject: | new spam case |
New spam case.
Patch attached or in gitorious.
Subject: | 0001-Another-spam-case.patch |
From 2a14e5d628187af011c85714b8e8d457b8b9282b Mon Sep 17 00:00:00 2001
From: Michael Stevens <mstevens@etla.org>
Date: Mon, 24 Oct 2011 17:13:05 +0100
Subject: [PATCH] Another spam case.
---
MANIFEST | 2 +
lib/Mail/DeliveryStatus/BounceParser.pm | 3 +-
t/corpus/spam-rejection24.msg | 93 +++++++++++++++++++++++++++++++
t/spam-rejection24.t | 29 ++++++++++
4 files changed, 126 insertions(+), 1 deletions(-)
create mode 100644 t/corpus/spam-rejection24.msg
create mode 100644 t/spam-rejection24.t
diff --git a/MANIFEST b/MANIFEST
index 06f6339..f504931 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -92,6 +92,7 @@ t/corpus/spam-rejection20.msg
t/corpus/spam-rejection21.msg
t/corpus/spam-rejection22.msg
t/corpus/spam-rejection23.msg
+t/corpus/spam-rejection24.msg
t/corpus/spam-rejection-uribl.msg
t/corpus/spam-with-badly-parsed-email.msg
t/corpus/spam-with-image.msg
@@ -169,6 +170,7 @@ t/spam-rejection20.t
t/spam-rejection21.t
t/spam-rejection22.t
t/spam-rejection23.t
+t/spam-rejection24.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 47ada91..c120d90 100644
--- a/lib/Mail/DeliveryStatus/BounceParser.pm
+++ b/lib/Mail/DeliveryStatus/BounceParser.pm
@@ -1041,7 +1041,8 @@ sub _std_reason {
/accepted\s+due\s+to\s+spam\s+filter/i or
/content\s+filter\s+rejection/i or
/using\s+a\s+mass\s+mailer/i or
- /Spam\s+email/i
+ /Spam\s+email/i or
+ /Spam\s+content\s+matched/i
) {
return "spam";
}
diff --git a/t/corpus/spam-rejection24.msg b/t/corpus/spam-rejection24.msg
new file mode 100644
index 0000000..68abfab
--- /dev/null
+++ b/t/corpus/spam-rejection24.msg
@@ -0,0 +1,93 @@
+Delivered-To: automated-bounces+ef6d04e6-f38c-11e0-854f-be0087d98979@email.example.com
+Received: by 10.180.105.100 with SMTP id gl4cs124817wib;
+ Mon, 10 Oct 2011 15:12:47 -0700 (PDT)
+Received: by 10.227.200.146 with SMTP id ew18mr7056930wbb.16.1318284766356;
+ Mon, 10 Oct 2011 15:12:46 -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 fl17si14714845wbb.107.2011.10.10.15.12.46;
+ Mon, 10 Oct 2011 15:12:46 -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 EBB3B651198; Mon, 10 Oct 2011 23:12:45 +0100 (BST)
+Date: Mon, 10 Oct 2011 23:12:45 +0100 (BST)
+From: MAILER-DAEMON@admin1.example.co.uk (Mail Delivery System)
+Subject: Undelivered Mail Returned to Sender
+To: automated-bounces+EF6D04E6-F38C-11E0-854F-BE0087D98979@email.example.com
+Auto-Submitted: auto-replied
+MIME-Version: 1.0
+Content-Type: multipart/report; report-type=delivery-status;
+ boundary="E8E46651197.1318284765/admin1.example.co.uk"
+Message-Id: <20111010221245.EBB3B651198@admin1.example.co.uk>
+
+This is a MIME-encapsulated message.
+
+--E8E46651197.1318284765/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
+
+<fred.bloggs@test.co.ug>: host mail.broadbandcompany.ug[41.138.0.6] said:
+ 554 Failure Spam content matched. Fix using:
+ http://test.co.ug/cgi/user.cgi?cmd=r&f=15436278 (in reply to end of
+ DATA command)
+
+--E8E46651197.1318284765/admin1.example.co.uk
+Content-Description: Delivery report
+Content-Type: message/delivery-status
+
+Reporting-MTA: dns; admin1.example.co.uk
+X-Postfix-Queue-ID: E8E46651197
+X-Postfix-Sender: rfc822; automated-bounces+EF6D04E6-F38C-11E0-854F-BE0087D98979@email.example.com
+Arrival-Date: Mon, 10 Oct 2011 23:12:25 +0100 (BST)
+
+Final-Recipient: rfc822; fred.bloggs@test.co.ug
+Action: failed
+Status: 5.0.0
+Remote-MTA: dns; mail.broadbandcompany.ug
+Diagnostic-Code: smtp; 554 Failure Spam content matched. Fix using:
+ http://test.co.ug/cgi/user.cgi?cmd=r&f=15436278
+
+--E8E46651197.1318284765/admin1.example.co.uk
+Content-Description: Undelivered Message
+Content-Type: message/rfc822
+
+Received: by admin1.example.co.uk (Postfix, from userid 507)
+ id E8E46651197; Mon, 10 Oct 2011 23:12:25 +0100 (BST)
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Content-Type: multipart/related; boundary="_----------=_131828474589660"
+X-Mailer: MIME::Lite 3.027 (F2.78; T1.31; A2.07; B3.13; Q3.13)
+Date: Mon, 10 Oct 2011 23:12:25 +0100
+From: John Smith <john.smith@email.example.com>
+Subject: foo
+X-Campaignid: example20100129.2
+List-Unsubscribe: <http://www.exampleoffers.co.uk/unsubscribe.epl?uuid=EF6D04E6-F38C-11E0-854F-BE0087D98979>
+To: fred bloggs <fred.bloggs@test.co.ug>
+Message-Id: <20111010221225.E8E46651197@admin1.example.co.uk>
+
+This is a multi-part message in MIME format.
+
+--_----------=_131828474589660
+Content-Disposition: inline
+Content-Transfer-Encoding: quoted-printable
+Content-Type: text/html
+
+HTML
+
+--_----------=_131828474589660--
+
+
+--E8E46651197.1318284765/admin1.example.co.uk--
diff --git a/t/spam-rejection24.t b/t/spam-rejection24.t
new file mode 100644
index 0000000..519463e
--- /dev/null
+++ b/t/spam-rejection24.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-rejection24.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