Subject: | German over quota |
Add a german over quota case.
http://gitorious.org/mail-deliverystatus-bounceparser-fork/mail-
deliverystatus-bounceparser-
fork/commit/130e9d61f1286841070d76ec46ee4ba5a7418e26
Link to gitorious and raw patch.
Subject: | german-quota-patch.txt |
From 130e9d61f1286841070d76ec46ee4ba5a7418e26 Mon Sep 17 00:00:00 2001
From: Michael Stevens <mstevens@etla.org>
Date: Tue, 16 Nov 2010 15:18:42 +0000
Subject: [PATCH] Add a german over quota case.
---
MANIFEST | 2 +
lib/Mail/DeliveryStatus/BounceParser.pm | 3 +-
t/corpus/quota-6.msg | 92 +++++++++++++++++++++++++++++++
t/quota-6.t | 29 ++++++++++
4 files changed, 125 insertions(+), 1 deletions(-)
create mode 100644 t/corpus/quota-6.msg
create mode 100644 t/quota-6.t
diff --git a/MANIFEST b/MANIFEST
index 43847af..79c47e8 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -56,6 +56,7 @@ t/corpus/quota-2.msg
t/corpus/quota-3.msg
t/corpus/quota-4.msg
t/corpus/quota-5.msg
+t/corpus/quota-6.msg
t/corpus/quota.msg
t/corpus/relaying-denied.msg
t/corpus/sendmail-host-unknown.msg
@@ -113,6 +114,7 @@ t/quota-2.t
t/quota-3.t
t/quota-4.t
t/quota-5.t
+t/quota-6.t
t/quota.t
t/relaying-denied.t
t/spam-bogus-email-in-report.t
diff --git a/lib/Mail/DeliveryStatus/BounceParser.pm b/lib/Mail/DeliveryStatus/BounceParser.pm
index 15ed21c..b50740f 100644
--- a/lib/Mail/DeliveryStatus/BounceParser.pm
+++ b/lib/Mail/DeliveryStatus/BounceParser.pm
@@ -932,7 +932,8 @@ sub _std_reason {
/User\s+mailbox\s+exceeds\s+allowed\s+size/i or
/Mailbox\s+size\s+limit\s+exceeded/i or
/message\s+size\s+\d+\s+exceeds\s+size\s+limit\s+\d+/i or
- /max\s+message\s+size\s+exceeded/i
+ /max\s+message\s+size\s+exceeded/i or
+ /Benutzer\s+hat\s+zuviele\s+Mails\s+auf\s+dem\s+Server/i
) {
return "over_quota";
}
diff --git a/t/corpus/quota-6.msg b/t/corpus/quota-6.msg
new file mode 100644
index 0000000..e20dbd4
--- /dev/null
+++ b/t/corpus/quota-6.msg
@@ -0,0 +1,92 @@
+Delivered-To: automated-bounces+8b072ea2-f0c5-11df-accf-8148583e2313@email.example.com
+Received: by 10.216.139.130 with SMTP id c2cs134824wej;
+ Mon, 15 Nov 2010 06:35:09 -0800 (PST)
+Received: by 10.216.11.205 with SMTP id 55mr738044wex.72.1289831708152;
+ Mon, 15 Nov 2010 06:35:08 -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 y84si55304weq.44.2010.11.15.06.35.08;
+ Mon, 15 Nov 2010 06:35:08 -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 E606016581F8; Mon, 15 Nov 2010 14:35:07 +0000 (GMT)
+Date: Mon, 15 Nov 2010 14:35:07 +0000 (GMT)
+From: MAILER-DAEMON@server4.example.co.uk (Mail Delivery System)
+Subject: Undelivered Mail Returned to Sender
+To: automated-bounces+8B072EA2-F0C5-11DF-ACCF-8148583E2313@email.example.com
+Auto-Submitted: auto-replied
+MIME-Version: 1.0
+Content-Type: multipart/report; report-type=delivery-status;
+ boundary="999E316581F7.1289831707/server4.example.co.uk"
+Message-Id: <20101115143507.E606016581F8@server4.example.co.uk>
+
+This is a MIME-encapsulated message.
+
+--999E316581F7.1289831707/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
+
+<fred.bloggs@web.de>: host mx-ha01.web.de[217.72.192.149] said: 550
+ <fred.bloggs@web.de> Benutzer hat zuviele Mails auf dem Server. / User
+ has too many messages on the server. (in reply to RCPT TO command)
+
+--999E316581F7.1289831707/server4.example.co.uk
+Content-Description: Delivery report
+Content-Type: message/delivery-status
+
+Reporting-MTA: dns; server4.example.co.uk
+X-Postfix-Queue-ID: 999E316581F7
+X-Postfix-Sender: rfc822; automated-bounces+8B072EA2-F0C5-11DF-ACCF-8148583E2313@email.example.com
+Arrival-Date: Mon, 15 Nov 2010 14:35:07 +0000 (GMT)
+
+Final-Recipient: rfc822; fred.bloggs@web.de
+Action: failed
+Status: 5.0.0
+Remote-MTA: dns; mx-ha01.web.de
+Diagnostic-Code: smtp; 550 <fred.bloggs@web.de> Benutzer hat zuviele Mails
+ auf dem Server. / User has too many messages on the server.
+
+--999E316581F7.1289831707/server4.example.co.uk
+Content-Description: Undelivered Message
+Content-Type: message/rfc822
+
+Received: by server4.example.co.uk (Postfix, from userid 505)
+ id 999E316581F7; Mon, 15 Nov 2010 14:35:07 +0000 (GMT)
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Content-Type: multipart/related; boundary="_----------=_12898317074814282"
+X-Mailer: MIME::Lite 3.027 (F2.77; T1.28; A2.04; B3.08; Q3.08)
+Date: Mon, 15 Nov 2010 14:35:07 +0000
+From: John Smith <john.smith@email.example.com>
+Subject: Foo
+X-Campaignid: example20100129.2
+List-Unsubscribe: <http://www.exampleoffers.co.uk/unsubscribe.epl?uuid=8B072EA2-F0C5-11DF-ACCF-8148583E2313>
+To: Fred Bloggs <fred.bloggs@web.de>
+Message-Id: <20101115143507.999E316581F7@server4.example.co.uk>
+
+This is a multi-part message in MIME format.
+
+--_----------=_12898317074814282
+Content-Disposition: inline
+Content-Transfer-Encoding: quoted-printable
+Content-Type: text/html
+
+HTML goes here.
+
+--_----------=_12898317074814282--
+
+
+--999E316581F7.1289831707/server4.example.co.uk--
diff --git a/t/quota-6.t b/t/quota-6.t
new file mode 100644
index 0000000..980a839
--- /dev/null
+++ b/t/quota-6.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/quota-6.msg');
+
+my $bounce = Mail::DeliveryStatus::BounceParser->new($message);
+
+isa_ok($bounce, 'Mail::DeliveryStatus::BounceParser');
+ok($bounce->is_bounce, "It's a bounce");
+
+my ($report) = $bounce->reports;
+
+my $std_reason = $report->get("std_reason");
+
+is($std_reason, "over_quota", "std reason is over_quota");
--
1.6.1