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: 63747
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.525
Fixed in: (no value)



CC: michael.stevens [...] dianomi.com,michael.smith [...] dianomi.com
Subject: Another spam case
Another spam detection case. Gitorious link: http://gitorious.org/mail-deliverystatus-bounceparser-fork/mail- deliverystatus-bounceparser- fork/commit/18a81e5bf9410bfc46f2055f6753941ed1abd557 Also attached the raw patch.
Subject: spam-detection.patch.txt
From 7e79b7f903d74d2d7954cef14f280dc0a7c062cc Mon Sep 17 00:00:00 2001 From: Michael Stevens <mstevens@etla.org> Date: Wed, 8 Dec 2010 17:58:46 +0000 Subject: [PATCH] Add another spam detection case. --- MANIFEST | 2 + lib/Mail/DeliveryStatus/BounceParser.pm | 4 +- t/corpus/spam-rejection9.msg | 91 +++++++++++++++++++++++++++++++ t/spam-rejection9.t | 29 ++++++++++ 4 files changed, 125 insertions(+), 1 deletions(-) create mode 100644 t/corpus/spam-rejection9.msg create mode 100644 t/spam-rejection9.t diff --git a/MANIFEST b/MANIFEST index 4317da2..66c9d46 100644 --- a/MANIFEST +++ b/MANIFEST @@ -72,6 +72,7 @@ t/corpus/spam-rejection5.msg t/corpus/spam-rejection6.msg t/corpus/spam-rejection7.msg t/corpus/spam-rejection8.msg +t/corpus/spam-rejection9.msg t/corpus/spam-with-badly-parsed-email.msg t/corpus/spam-with-image.msg t/corpus/spamassassin.msg @@ -129,6 +130,7 @@ t/spam-rejection5.t t/spam-rejection6.t t/spam-rejection7.t t/spam-rejection8.t +t/spam-rejection9.t t/spam-with-image.t t/spamassassin.t t/spambouncer.t diff --git a/lib/Mail/DeliveryStatus/BounceParser.pm b/lib/Mail/DeliveryStatus/BounceParser.pm index 8da8394..b49ff2c 100644 --- a/lib/Mail/DeliveryStatus/BounceParser.pm +++ b/lib/Mail/DeliveryStatus/BounceParser.pm @@ -1013,7 +1013,9 @@ sub _std_reason { /your\s+message\s+has\s+triggered\s+a\s+SPAM\s+block/i or /Spam\s+detected/i or /Message\s+looks\s+like\s+spam/i or - /Message\s+content\s+rejected,\s+UBE/i + /Message\s+content\s+rejected,\s+UBE/i or + /Blocked\s+using\s+spam\s+pattern/i + ) { return "spam"; } diff --git a/t/corpus/spam-rejection9.msg b/t/corpus/spam-rejection9.msg new file mode 100644 index 0000000..cc0f9b1 --- /dev/null +++ b/t/corpus/spam-rejection9.msg @@ -0,0 +1,91 @@ +Delivered-To: automated-bounces+be7a91d4-02cc-11e0-b64e-7a97dd31f8f5@email.example.com +Received: by 10.216.139.130 with SMTP id c2cs15069wej; + Wed, 8 Dec 2010 05:12:25 -0800 (PST) +Received: by 10.227.132.70 with SMTP id a6mr8974856wbt.85.1291813944341; + Wed, 08 Dec 2010 05:12:24 -0800 (PST) +Return-Path: <> +Received: from server4.example.co.uk (server4.example.co.uk [94.236.45.212]) + by mx.google.com with ESMTP id 2si827809wbi.44.2010.12.08.05.12.24; + Wed, 08 Dec 2010 05:12:24 -0800 (PST) +Received-SPF: pass (google.com: best guess record for domain of server4.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: best guess record for domain of server4.example.co.uk designates 94.236.45.212 as permitted sender) smtp.mail= +Received: by server4.example.co.uk (Postfix) + id 1727816581D5; Wed, 8 Dec 2010 13:12:24 +0000 (GMT) +Date: Wed, 8 Dec 2010 13:12:24 +0000 (GMT) +From: MAILER-DAEMON@server4.example.co.uk (Mail Delivery System) +Subject: Undelivered Mail Returned to Sender +To: automated-bounces+BE7A91D4-02CC-11E0-B64E-7A97DD31F8F5@email.example.com +Auto-Submitted: auto-replied +MIME-Version: 1.0 +Content-Type: multipart/report; report-type=delivery-status; + boundary="81E631658177.1291813944/server4.example.co.uk" +Message-Id: <20101208131224.1727816581D5@server4.example.co.uk> + +This is a MIME-encapsulated message. + +--81E631658177.1291813944/server4.example.co.uk +Content-Description: Notification +Content-Type: text/plain; charset=us-ascii + +This is the mail system at host server4.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 + +<recipient@example.net>: host spam.example.net[210.105.137.8] said: 553 Blocked + using spam pattern, your message may contain the spam contents (in reply to + end of DATA command) + +--81E631658177.1291813944/server4.example.co.uk +Content-Description: Delivery report +Content-Type: message/delivery-status + +Reporting-MTA: dns; server4.example.co.uk +X-Postfix-Queue-ID: 81E631658177 +X-Postfix-Sender: rfc822; automated-bounces+BE7A91D4-02CC-11E0-B64E-7A97DD31F8F5@email.example.com +Arrival-Date: Wed, 8 Dec 2010 13:12:01 +0000 (GMT) + +Final-Recipient: rfc822; recipient@example.net +Action: failed +Status: 5.0.0 +Remote-MTA: dns; spam.example.net +Diagnostic-Code: smtp; 553 Blocked using spam pattern, your message may contain + the spam contents + +--81E631658177.1291813944/server4.example.co.uk +Content-Description: Undelivered Message +Content-Type: message/rfc822 + +Received: by server4.example.co.uk (Postfix, from userid 507) + id 81E631658177; Wed, 8 Dec 2010 13:12:01 +0000 (GMT) +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: multipart/related; boundary="_----------=_1291813921232180" +X-Mailer: MIME::Lite 3.027 (F2.77; T1.28; A2.04; B3.08; Q3.08) +Date: Wed, 8 Dec 2010 13:12:01 +0000 +From: Fred Bloggs <fred.bloggs@email.example.com> +Subject: foo +List-Unsubscribe: <http://www.exampleoffers.co.uk/unsubscribe.epl?uuid=BE7A91D4-02CC-11E0-B64E-7A97DD31F8F5> +To: recipient <recipient@example.net> +Message-Id: <20101208131201.81E631658177@server4.example.co.uk> + +This is a multi-part message in MIME format. + +--_----------=_1291813921232180 +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable +Content-Type: text/html + +HTML + +--_----------=_1291813921232180-- + + +--81E631658177.1291813944/server4.example.co.uk-- diff --git a/t/spam-rejection9.t b/t/spam-rejection9.t new file mode 100644 index 0000000..d596c1f --- /dev/null +++ b/t/spam-rejection9.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-rejection9.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.6.1