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: 69123
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: Another spam case
Another spam detection case. In git at: https://gitorious.org/mail-deliverystatus-bounceparser- fork/mail-deliverystatus-bounceparser- fork/commit/492c67928cc83751ef32327912d2c9c926122e4f
Subject: 0001-Another-spam-case.patch
From 492c67928cc83751ef32327912d2c9c926122e4f Mon Sep 17 00:00:00 2001 From: Michael Stevens <mstevens@etla.org> Date: Tue, 28 Jun 2011 16:09:01 +0100 Subject: [PATCH] Another spam case --- MANIFEST | 2 + lib/Mail/DeliveryStatus/BounceParser.pm | 3 +- t/corpus/spam-rejection14.msg | 113 +++++++++++++++++++++++++++++++ t/spam-rejection14.t | 29 ++++++++ 4 files changed, 146 insertions(+), 1 deletions(-) create mode 100644 t/corpus/spam-rejection14.msg create mode 100644 t/spam-rejection14.t diff --git a/MANIFEST b/MANIFEST index b4ab701..d5b0bd0 100644 --- a/MANIFEST +++ b/MANIFEST @@ -82,6 +82,7 @@ t/corpus/spam-rejection10.msg t/corpus/spam-rejection11.msg t/corpus/spam-rejection12.msg t/corpus/spam-rejection13.msg +t/corpus/spam-rejection14.msg t/corpus/spam-rejection-uribl.msg t/corpus/spam-with-badly-parsed-email.msg t/corpus/spam-with-image.msg @@ -149,6 +150,7 @@ t/spam-rejection10.t t/spam-rejection11.t t/spam-rejection12.t t/spam-rejection13.t +t/spam-rejection14.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 6194c5a..afc21de 100644 --- a/lib/Mail/DeliveryStatus/BounceParser.pm +++ b/lib/Mail/DeliveryStatus/BounceParser.pm @@ -1031,7 +1031,8 @@ sub _std_reason { /Your\s+email\s+had\s+spam-like\s+header\s+contents/i or /detected\s+as\s+spam/i or /Denied\s+due\s+to\s+spam\s+list/i or - /appears\s+to\s+be\s+unsolicited/i + /appears\s+to\s+be\s+unsolicited/i or + /antispam\s+checks/i ) { return "spam"; } diff --git a/t/corpus/spam-rejection14.msg b/t/corpus/spam-rejection14.msg new file mode 100644 index 0000000..21d87a2 --- /dev/null +++ b/t/corpus/spam-rejection14.msg @@ -0,0 +1,113 @@ +Delivered-To: automated-bounces+7dfc55b4-9da1-11e0-8320-d486a7abecde@email.example.com +Received: by 10.14.188.136 with SMTP id a8cs30277een; + Thu, 23 Jun 2011 07:03:02 -0700 (PDT) +Received: by 10.227.156.70 with SMTP id v6mr2016640wbw.21.1308837781574; + Thu, 23 Jun 2011 07:03:01 -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 ep1si3867852wbb.146.2011.06.23.07.03.00; + Thu, 23 Jun 2011 07:03:00 -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 60DDD6510A3; Thu, 23 Jun 2011 15:02:59 +0100 (BST) +Date: Thu, 23 Jun 2011 15:02:59 +0100 (BST) +From: MAILER-DAEMON@admin1.example.co.uk (Mail Delivery System) +Subject: Undelivered Mail Returned to Sender +To: automated-bounces+7DFC55B4-9DA1-11E0-8320-D486A7ABECDE@email.example.com +Auto-Submitted: auto-replied +MIME-Version: 1.0 +Content-Type: multipart/report; report-type=delivery-status; + boundary="216986510A0.1308837779/admin1.example.co.uk" +Content-Transfer-Encoding: 8bit +Message-Id: <20110623140259.60DDD6510A3@admin1.example.co.uk> + +This is a MIME-encapsulated message. + +--216986510A0.1308837779/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@example.net>: host example.net[213.5.177.106] said: 554 5.7.1 Your + message failed several antispam checks (SCORING) and it was rejected or + collected on example.net spambox. Please be sure your mailserver is + configured correctly (spf , HELO, PTR) or try using an alternative email or + smtp. (in reply to end of DATA command) + +--216986510A0.1308837779/admin1.example.co.uk +Content-Description: Delivery report +Content-Type: message/delivery-status + +Reporting-MTA: dns; admin1.example.co.uk +X-Postfix-Queue-ID: 216986510A0 +X-Postfix-Sender: rfc822; automated-bounces+7DFC55B4-9DA1-11E0-8320-D486A7ABECDE@email.example.com +Arrival-Date: Thu, 23 Jun 2011 15:02:55 +0100 (BST) + +Final-Recipient: rfc822; fred@example.net +Action: failed +Status: 5.7.1 +Remote-MTA: dns; example.net +Diagnostic-Code: smtp; 554 5.7.1 Your message failed several antispam checks + (SCORING) and it was rejected or collected on example.net spambox. Please + be sure your mailserver is configured correctly (spf , HELO, PTR) or try + using an alternative email or smtp. + +--216986510A0.1308837779/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 216986510A0; Thu, 23 Jun 2011 15:02:55 +0100 (BST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=email.example.com; + s=default10; t=1308837775; + bh=Qnt0BqDOUNy4AwNrcMwHMREffyRD9lZoicnLoRl0mRE=; + h=MIME-Version:Content-Transfer-Encoding:Content-Type:Date:From: + Subject:List-Unsubscribe:To:Message-Id; + b=aE1AuvOQ+0CPCFaDKKuNzaoQARNdQcHe9D+4Dy5+JVyaHZTqVne12fN9ejXOHH7Te + ECJVpDjXmhcgRHFdYL+JMF2A0gr5oKGIoaBGKBYLRvd7xEeMRRkXujXWubHzQpCera + Iv+c2CkqYMwn6RoctuPYzinBYiPHULsreZBJftoY= +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: multipart/alternative; boundary="_----------=_13088377751141040" +X-Mailer: MIME::Lite 3.027 (F2.78; T1.31; A2.07; B3.13; Q3.13) +Date: Thu, 23 Jun 2011 15:02:55 +0100 +From: John Smith <john.smith@email.example.com> +Subject: foo +X-Campaignid: example20110504.1 +List-Unsubscribe: <http://www.exampleoffers.co.uk/unsubscribe.epl?uuid=7DFC55B4-9DA1-11E0-8320-D486A7ABECDE> +To: Fred Bloggs <fred@example.net> +Message-Id: <20110623140255.216986510A0@admin1.example.co.uk> + +This is a multi-part message in MIME format. + +--_----------=_13088377751141040 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +Content-Type: text/plain + +Text + +--_----------=_13088377751141040 +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable +Content-Type: text/html + +HTML + +--_----------=_13088377751141040-- + + +--216986510A0.1308837779/admin1.example.co.uk-- diff --git a/t/spam-rejection14.t b/t/spam-rejection14.t new file mode 100644 index 0000000..4d94433 --- /dev/null +++ b/t/spam-rejection14.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-rejection14.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