CC: | michael.stevens [...] dianomi.com, michael.smith [...] dianomi.com |
Subject: | add another user unknown case |
Add another user unknown case.
diff attached or in git at https://gitorious.org/mail-deliverystatus-
bounceparser-fork/mail-deliverystatus-bounceparser-
fork/commit/793c3ccccb8a099dabdcc11fc1a33aa554f49cda
Subject: | 0001-Add-another-user-unknown-case.patch |
From 793c3ccccb8a099dabdcc11fc1a33aa554f49cda Mon Sep 17 00:00:00 2001
From: Michael Stevens <mstevens@etla.org>
Date: Tue, 28 Jun 2011 15:58:47 +0100
Subject: [PATCH] Add another user unknown case
---
MANIFEST | 1 +
lib/Mail/DeliveryStatus/BounceParser.pm | 3 +-
t/corpus/user-unknown-not.msg | 98 +++++++++++++++++++++++++++++++
t/various-unknown.t | 6 ++-
4 files changed, 106 insertions(+), 2 deletions(-)
create mode 100644 t/corpus/user-unknown-not.msg
diff --git a/MANIFEST b/MANIFEST
index 2960490..b4ab701 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -107,6 +107,7 @@ t/corpus/whitelist.msg
t/corpus/rcpthosts.msg
t/corpus/rcpt-dne.msg
t/corpus/user-unknown-dne.msg
+t/corpus/user-unknown-not.msg
t/corpus/user-unknown-disabled.msg
t/corpus/user-unknown-not-active.msg
t/autoreply.t
diff --git a/lib/Mail/DeliveryStatus/BounceParser.pm b/lib/Mail/DeliveryStatus/BounceParser.pm
index d281510..6194c5a 100644
--- a/lib/Mail/DeliveryStatus/BounceParser.pm
+++ b/lib/Mail/DeliveryStatus/BounceParser.pm
@@ -991,7 +991,8 @@ sub _std_reason {
/No\s+mail\s+box\s+available\s+for\s+this\s+user/i or
/User\s+\[\S+\]\s+does\s+not\s+exist/i or
/email\s+account\s+that\s+you\s+tried\s+to\s+reach\s+is\s+disabled/i or
- /not\s+an\s+active\s+address\s+at\s+this\s+host/i
+ /not\s+an\s+active\s+address\s+at\s+this\s+host/i or
+ /not\s+a\s+known\s+user/i
) {
return "user_unknown";
}
diff --git a/t/corpus/user-unknown-not.msg b/t/corpus/user-unknown-not.msg
new file mode 100644
index 0000000..b3f6e6e
--- /dev/null
+++ b/t/corpus/user-unknown-not.msg
@@ -0,0 +1,98 @@
+Delivered-To: automated-bounces+4f8299cc-9f0f-11e0-bbef-e9a9eaa10225@email.example.com
+Received: by 10.14.188.136 with SMTP id a8cs1966een;
+ Sat, 25 Jun 2011 02:41:35 -0700 (PDT)
+Received: by 10.216.237.205 with SMTP id y55mr516456weq.49.1308994895627;
+ Sat, 25 Jun 2011 02:41:35 -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 e2si7725153wed.116.2011.06.25.02.41.34;
+ Sat, 25 Jun 2011 02:41:34 -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 802CC15480A4; Sat, 25 Jun 2011 10:41:33 +0100 (BST)
+Date: Sat, 25 Jun 2011 10:41:33 +0100 (BST)
+From: MAILER-DAEMON@admin1.example.co.uk (Mail Delivery System)
+Subject: Undelivered Mail Returned to Sender
+To: automated-bounces+4F8299CC-9F0F-11E0-BBEF-E9A9EAA10225@email.example.com
+Auto-Submitted: auto-replied
+MIME-Version: 1.0
+Content-Type: multipart/report; report-type=delivery-status;
+ boundary="D7B7C15480A3.1308994893/admin1.example.co.uk"
+Content-Transfer-Encoding: 8bit
+Message-Id: <20110625094133.802CC15480A4@admin1.example.co.uk>
+
+This is a MIME-encapsulated message.
+
+--D7B7C15480A3.1308994893/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
+
+<recipient@example.net>: host mx-vh.sample.com[80.168.44.12] said: 550
+ "recipient@example.net" is not a known user (in reply to RCPT TO command)
+
+--D7B7C15480A3.1308994893/admin1.example.co.uk
+Content-Description: Delivery report
+Content-Type: message/delivery-status
+
+Reporting-MTA: dns; admin1.example.co.uk
+X-Postfix-Queue-ID: D7B7C15480A3
+X-Postfix-Sender: rfc822; automated-bounces+4F8299CC-9F0F-11E0-BBEF-E9A9EAA10225@email.example.com
+Arrival-Date: Sat, 25 Jun 2011 10:41:32 +0100 (BST)
+
+Final-Recipient: rfc822; recipient@example.net
+Action: failed
+Status: 5.0.0
+Remote-MTA: dns; mx-vh.sample.com
+Diagnostic-Code: smtp; 550 "recipient@example.net" is not a known user
+
+--D7B7C15480A3.1308994893/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 D7B7C15480A3; Sat, 25 Jun 2011 10:41:32 +0100 (BST)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=email.example.com;
+ s=default10; t=1308994892;
+ bh=DpXKw3UluI+4xWPwOU7xdU7m5XGtbAzppF96DMtgkto=;
+ h=MIME-Version:Content-Transfer-Encoding:Content-Type:Date:From:
+ Subject:List-Unsubscribe:To:Message-Id;
+ b=AqTDNO2CiXIC88RYPdbkpxtKwbmM0CZCyAIiGVuW8fRl59sJ1rWAGzX5ozpFxcTCb
+ 3KMXeXeOXnbfQs++rNou5CxaMjdIoFzckE00AQBEbQC581JdqQPyNv6TE89fbjFT+K
+ fZHkwVxemGVaaQDxNqA5HvfmA8iJuuAb+ETqLMTA=
+MIME-Version: 1.0
+Content-Transfer-Encoding: binary
+Content-Type: multipart/related; boundary="_----------=_13089948924372610"
+X-Mailer: MIME::Lite 3.027 (F2.78; T1.31; A2.07; B3.13; Q3.13)
+Date: Sat, 25 Jun 2011 10:41:32 +0100
+From: Fred Bloggs <fred.bloggs@email.example.com>
+Subject: foo
+List-Unsubscribe: <http://www.exampleoffers.co.uk/unsubscribe.epl?uuid=4F8299CC-9F0F-11E0-BBEF-E9A9EAA10225>
+To: Recipient <recipient@example.net>
+Message-Id: <20110625094132.D7B7C15480A3@admin1.example.co.uk>
+
+This is a multi-part message in MIME format.
+
+--_----------=_13089948924372610
+Content-Disposition: inline
+Content-Transfer-Encoding: 8bit
+Content-Type: text/html
+
+HTML
+--_----------=_13089948924372610--
+
+
+--D7B7C15480A3.1308994893/admin1.example.co.uk--
diff --git a/t/various-unknown.t b/t/various-unknown.t
index b1f2c90..5ded4e9 100644
--- a/t/various-unknown.t
+++ b/t/various-unknown.t
@@ -2,7 +2,7 @@
use strict;
# Add 6 to this for each case you add to %files_and_responses
-use Test::More tests => 168;
+use Test::More tests => 174;
use Mail::DeliveryStatus::BounceParser;
@@ -160,6 +160,10 @@ This is a permanent error; I've given up. Sorry it didn't work out.",
"reason" => '550-recipient@example.net is not an active address at this host (invalid FreeUK 550 username)',
"smtp_code" => "550",
},
+ "user-unknown-not.msg" => {
+ "reason" => '550 "recipient@example.net" is not a known user',
+ "smtp_code" => "550",
+ }
);
foreach my $file (keys %files_and_responses) {
--
1.7.4.1