From 9517e6831a55511c246bac4c4677903d5c6d5de2 Mon Sep 17 00:00:00 2001
From: Michael Stevens <mstevens@etla.org>
Date: Tue, 16 Nov 2010 14:52:17 +0000
Subject: [PATCH] Add a new case to handle boxbe C/R messages.
---
MANIFEST | 2 +
lib/Mail/DeliveryStatus/BounceParser.pm | 7 +
t/boxbe.t | 25 ++++
t/corpus/boxbe-cr.msg | 194 +++++++++++++++++++++++++++++++
4 files changed, 228 insertions(+), 0 deletions(-)
create mode 100644 t/boxbe.t
create mode 100644 t/corpus/boxbe-cr.msg
diff --git a/MANIFEST b/MANIFEST
index 0f7d956..43847af 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -17,12 +17,14 @@ t/00-load.t
t/aol-attachment.t
t/aol-senderblock.t
t/bluebottle.t
+t/boxbe.t
t/corpus/aol-senderblock.msg
t/corpus/aol.attachment.msg
t/corpus/aol.unknown.msg
t/corpus/aol-vacation.msg
t/corpus/att-via-sendmail.unknown.msg
t/corpus/bluebottle.msg
+t/corpus/boxbe-cr.msg
t/corpus/comcast-via-sendmail.unknown.msg
t/corpus/cox-via-sendmail.unknown.msg
t/corpus/deactivated-mailbox.msg
diff --git a/lib/Mail/DeliveryStatus/BounceParser.pm b/lib/Mail/DeliveryStatus/BounceParser.pm
index 4eec859..15ed21c 100644
--- a/lib/Mail/DeliveryStatus/BounceParser.pm
+++ b/lib/Mail/DeliveryStatus/BounceParser.pm
@@ -191,6 +191,13 @@ sub parse {
return $self;
}
+ {
+ last unless $first_part->stringify_body =~ /Please add yourself to my Boxbe Guest List/;
+ $self->log("Looks like a challenge/response autoresponse; ignoring.");
+ $self->{type} = "Challenge / Response system autoreply";
+ $self->{is_bounce} = 0;
+ }
+
# we'll deem autoreplies to be usually less than a certain size.
# Some vacation autoreplies are (sigh) multipart/mixed, with an additional
diff --git a/t/boxbe.t b/t/boxbe.t
new file mode 100644
index 0000000..4a034ff
--- /dev/null
+++ b/t/boxbe.t
@@ -0,0 +1,25 @@
+#!perl -wT
+use strict;
+
+use Test::More tests => 2;
+
+use Mail::DeliveryStatus::BounceParser;
+
+# Test parsing boxbe Challlenge/Response
+
+# 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/boxbe-cr.msg');
+
+my $bounce = Mail::DeliveryStatus::BounceParser->new($message);
+
+isa_ok($bounce, 'Mail::DeliveryStatus::BounceParser');
+ok(!$bounce->is_bounce, "C/R messages are not bounces");
diff --git a/t/corpus/boxbe-cr.msg b/t/corpus/boxbe-cr.msg
new file mode 100644
index 0000000..13046d4
--- /dev/null
+++ b/t/corpus/boxbe-cr.msg
@@ -0,0 +1,194 @@
+Delivered-To: automated-bounces+12837740-f0bd-11df-96e6-8b387fa1e9d6@email.example.com
+Received: by 10.216.139.130 with SMTP id c2cs167332wej;
+ Mon, 15 Nov 2010 19:32:10 -0800 (PST)
+Received: by 10.151.154.3 with SMTP id g3mr3050560ybo.293.1289878329938;
+ Mon, 15 Nov 2010 19:32:09 -0800 (PST)
+Return-Path: <noreply@boxbe.com>
+Received: from qcfs002.boxbe.com (qcfs002.boxbe.com [38.110.147.11])
+ by mx.google.com with ESMTP id e2si10166031ybi.26.2010.11.15.19.32.08;
+ Mon, 15 Nov 2010 19:32:08 -0800 (PST)
+Received-SPF: pass (google.com: domain of noreply@boxbe.com designates 38.110.147.11 as permitted sender) client-ip=38.110.147.11;
+Authentication-Results: mx.google.com; spf=pass (google.com: domain of noreply@boxbe.com designates 38.110.147.11 as permitted sender) smtp.mail=noreply@boxbe.com; dkim=pass header.i=@boxbe.com
+Received: from qcfs002.boxbe.com (localhost [127.0.0.1])
+ by qcfs002.boxbe.com (Postfix) with ESMTP id AD0A714DF4C
+ for <automated-bounces+12837740-F0BD-11DF-96E6-8B387FA1E9D6@email.example.com>; Mon, 15 Nov 2010 19:32:07 -0800 (PST)
+DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=boxbe.com; h=date:from
+ :reply-to:to:message-id:subject:mime-version:content-type; s=s1;
+ bh=cbRAj7QORgX0do3rSnNpAJ97Tds=; b=ei+K483xFD/okHvnRbAAl5MYGkrd
+ qf233jV64hWzdTHI9ZKvyUvnO+CwZm9vZIzHu2YlaqBcBpuA0EKlbmuUVZryLkIl
+ XNl6MHIgDFT+BTco4i/Uj7iHTZL/4wF1MBfw9ZwKK0k1PgfjtDLr7+W38StTU/Fh
+ N/aWOmB1wRWxXxA=
+DomainKey-Signature: a=rsa-sha1; c=nofws; d=boxbe.com; h=date:from
+ :reply-to:to:message-id:subject:mime-version:content-type; q=
+ dns; s=s1; b=rYcC4iNkzJ7PYp27AmPLEplyp6l2b76/XeIwsKYO22SCRGMqYJ2
+ xgynCz1YFbxHueVm0JLqZ3UUmtcM5mLkXhikR8VKaDdmGhFR7BEBUDj7D3mhYqk6
+ C7lGICw0cXqmxoX41c3t4vBKfpDITUur18yRw0VrBNjmqTxr0/pI+Bss=
+Received: from app013.dmz (unknown [10.0.0.38])
+ by qcfs002.boxbe.com (Postfix) with ESMTP id 8000A14DF20
+ for <automated-bounces+12837740-F0BD-11DF-96E6-8B387FA1E9D6@email.example.com>; Mon, 15 Nov 2010 19:32:07 -0800 (PST)
+Date: Mon, 15 Nov 2010 19:32:07 -0800 (PST)
+From: noreply@boxbe.com
+Reply-To: bloggs.fred@googlemail.com
+To:
+ John Smith <automated-bounces+12837740-F0BD-11DF-96E6-8B387FA1E9D6@email.example.com>
+Message-ID: <2080270419.5898.1289878327481.JavaMail.prod@app013.dmz>
+Subject: Re: Dear Mr bloggs, get your Emerging Markets factsheet (Action
+ Required)
+MIME-Version: 1.0
+Content-Type: multipart/report;
+ boundary="----=_Part_5897_120486099.1289878327477";
+ report-type=delivery-status
+Envelope-From: <>
+
+------=_Part_5897_120486099.1289878327477
+Content-Type: multipart/alternative;
+ boundary="----=_Part_5896_721031160.1289878327476"
+Content-Disposition: inline
+Content-Description: Notification
+
+The contents of this message require a modern email client
+for correct display. If you are reading this message, it may
+be because your reader is without MIME support.
+
+You can visit
http://www.boxbe.com for more information about
+this problem, or consult the provider of your email reader.
+------=_Part_5896_721031160.1289878327476
+Content-Type: text/plain; charset=us-ascii
+Content-Transfer-Encoding: 7bit
+Content-Disposition: inline
+
+
+Hello John Smith,
+
+Your message about "Dear Mr bloggs, get your foo"
+has been waitlisted.
+
+Please add yourself to my Boxbe Guest List so your messages will
+go to my Inbox.
+
+Click the link below to be added:
+
https://www.boxbe.com/crs?tc=1234
+
+
+ Thank you,
+ fred bloggs
+
+
+About this Notice
+Boxbe prioritizes and screens email using a personal Guest List and your
+extended social network. It's free, it removes clutter, and it helps
+you focus on the people who matter to you.
+
+Visit
http://www.boxbe.com/how-it-works?tc=1234
+End Email Overload
+
+
+------=_Part_5896_721031160.1289878327476
+Content-Type: text/html; charset=us-ascii
+Content-Transfer-Encoding: 7bit
+Content-Disposition: inline
+
+
+
+<html>
+<body>
+<div style="width:500px;font-size:13px;font-family:'Lucida Grande', Helvetica, Arial, sans-serif;">
+
+ <p style="margin-bottom:7px;">
+ Hello John Smith,
+ </p>
+
+
+ <p style="margin-bottom:7px;">Your message about "Dear Mr bloggs, get your foo" was waitlisted.</p>
+
+ <p style="margin-bottom:7px;">
+ Please add yourself to my Guest List so your messages will be delivered to my Inbox. Use the link below.
+ </p>
+
+ <p style="margin-bottom:7px;font-size:14px;font-weight:bold;">
+ <a href="https://www.boxbe.com/crs?tc=1234" style="text-decoration:none;">
+ Click here to deliver your message
+ </a>
+ </p>
+
+
+
+ <p style="margin-bottom:7px;">Thank you,<br />
+ fred bloggs
+ </p>
+
+<p style="margin-bottom:7px;margin-top:20px;"><strong>About this Notice</strong><br />
+Boxbe (<a href="http://www.boxbe.com/?tc=1234">www.boxbe.com</a>) prioritizes and screens your email using a Guest List and your extended social network. It's free, it removes clutter, and it helps you focus on the people who matter to you.
+</p>
+
+<p style="margin-bottom:10px;">
+ <a style="margin-bottom:8px;" href="http://www.boxbe.com/how-it-works?tc=1234"><img style="border:none;" src="
http://www.boxbe.com/images/boxbe.gif?tc=1234" alt="Boxbe"></a><img src="
http://www.boxbe.com/stfopen?tc=1234"/>
+ <br />End Email Overload
+</p>
+
+</div>
+
+</body>
+</html>
+
+------=_Part_5896_721031160.1289878327476--
+
+------=_Part_5897_120486099.1289878327477
+Content-Type: message/delivery-status
+Content-Transfer-Encoding: 7bit
+Content-Description: Delivery report
+
+Reporting-MTA: dns; boxbe.com
+Remote-MTA: dns; yahoo.com
+Action: failed
+Arrival-Date: Mon, 15 Nov 2010 05:34:29 -0800 (PST)
+
+Final-Recipient: rfc822; bloggs.fred@googlemail.com
+Diagnostic-Code: X-Boxbe-Notice; Sender not pre-approved. Follow instructions in above notice
+Status: 4.7.0
+
+
+------=_Part_5897_120486099.1289878327477
+Content-Type: message/rfc822
+Content-Description: Undelivered Message
+
+Received-SPF: pass (google.com: domain of
+ automated-bounces+12837740-F0BD-11DF-96E6-8B387FA1E9D6@email.example.com
+ designates 94.236.45.212 as permitted sender) client-ip=94.236.45.212;
+Date: Mon, 15 Nov 2010 13:34:29 +0000
+Delivered-To: bloggs.fred@googlemail.com
+Content-Transfer-Encoding: 7bit
+Authentication-Results: mx.google.com; spf=pass (google.com: domain of
+ automated-bounces+12837740-F0BD-11DF-96E6-8B387FA1E9D6@email.example.com
+ designates 94.236.45.212 as permitted sender)
+ smtp.mail=automated-bounces+12837740-F0BD-11DF-96E6-8B387FA1E9D6@email.example.com;
+ dkim=pass header.i=@email.example.com
+Return-Path: <automated-bounces+12837740-F0BD-11DF-96E6-8B387FA1E9D6@email.example.com>
+Message-Id: <20101115133429.70E0916581C3@server4.example.co.uk>
+Received: by 10.223.74.206 with SMTP id v14cs87036faj; Mon, 15 Nov 2010
+ 05:34:33 -0800 (PST)
+Received: by 10.216.59.193 with SMTP id s43mr6803488wec.42.1289828071140; Mon,
+ 15 Nov 2010 05:34:31 -0800 (PST)
+Received: from server4.example.co.uk (server4.example.co.uk [94.236.45.212])
+ by mx.google.com with ESMTP id y10si10725371weq.129.2010.11.15.05.34.29; Mon,
+ 15 Nov 2010 05:34:30 -0800 (PST)
+Received: by server4.example.co.uk (Postfix, from userid 505) id 70E0916581C3;
+ Mon, 15 Nov 2010 13:34:29 +0000 (GMT)
+DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=email.example.com;
+ s=default10; t=1289828069; bh=lK75jnLTg6mSssK0L5J7BCobA3FyHDC32vsMjXTkmNk=;
+ h=MIME-Version:Content-Transfer-Encoding:Content-Type:Date:From:
+ Subject:List-Unsubscribe:To:Message-Id;
+ b=R4WqR7f3VWPZ4ZswdSiZo6PF0Mz/Ipepl63EAyPHSu1ju2VLvqyy0u2KYL30ZkTO7
+ jn/kIm6GA1rDTJIYa4z1IZK0GfYov19BcvAAwEcNXGCJHFmgg8mPf2rgv/gXraV/8P
+ aiLyj4aSO2LvxS0ShpwEtQpFka/B1VqXrcvULV0E=
+Subject: Dear Mr bloggs, get your foo
+To: fred bloggs <bloggs.fred@googlemail.com>
+From: John Smith <john.smith@email.example.com>
+List-Unsubscribe: <
http://www.exampleoffers.co.uk/unsubscribe.epl?uuid=12837740-F0BD-11DF-96E6-8B387FA1E9D6>
+X-Mailer: MIME::Lite 3.027 (F2.77; T1.28; A2.04; B3.08; Q3.08)
+Content-Type: multipart/related; boundary="_----------=_12898280692087431"
+X-Campaignid: example20100129.2
+MIME-Version: 1.0
+
+
+------=_Part_5897_120486099.1289878327477--
--
1.6.1