Skip to content

Commit

Permalink
Import Pull-Request #416, Thanks to @AmarkhiS
Browse files Browse the repository at this point in the history
  • Loading branch information
azumakuniyuki committed Nov 3, 2020
1 parent acf5a72 commit 840ed85
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/Sisimai/Lhost/Exim.pm
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ sub make {
This[ ]message[ ]was[ ]created[ ]automatically[ ]by[ ]mail[ ]delivery[ ]software[.]
|A[ ]message[ ]that[ ]you[ ]sent[ ]was[ ]rejected[ ]by[ ]the[ ]local[ ]scannning[ ]code
|A[ ]message[ ]that[ ]you[ ]sent[ ]contained[ ]one[ ]or[ ]more[ ]recipient[ ]addresses[ ]
|A[ ]message[ ]that[ ]you[ ]sent[ ]could[ ]not[ ]be[ ]delivered[ ]to[ ]all[ ]of[ ]its[ ]recipients
|Message[ ][^ ]+[ ](?:has[ ]been[ ]frozen|was[ ]frozen[ ]on[ ]arrival)
|The[ ][^ ]+[ ]router[ ]encountered[ ]the[ ]following[ ]error[(]s[)]:
)
Expand Down
4 changes: 4 additions & 0 deletions lib/Sisimai/Lhost/X3.pm
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ sub make {
} elsif( $e =~ /\ARouting: (.+)/ ) {
# Routing: Could not find a gateway for kijitora@example.co.jp
$v->{'diagnosis'} = $1;

} elsif( $e =~ /\ADiagnostic-Code: smtp; (.+)/ ) {
# Diagnostic-Code: smtp; 552 5.2.2 Over quota
$v->{'diagnosis'} = $1;
}
}
}
Expand Down
40 changes: 40 additions & 0 deletions set-of-emails/maildir/bsd/lhost-exim-61.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Return-Path: <>
X-Original-To: xxxx@xxxx.net
Delivered-To: xxxx@xxxx.xxxx.net
Received: from xxxx.xxxx.net (xxxx.xxxx.net)
by xxxx.xxxx.net (Postfix) with ESMTP id A1733205DF79
for <xxxx@xxxx.net>; Tue, 13 Oct 2020 12:04:02 +0200 (CEST)
Received: from exim by xxxx.xxxx.net with local (Exim 4.82_1-5b7a7c0-XX)
id 1kSH9f-0005xf-18
for xxxx@xxxx.net; Tue, 13 Oct 2020 12:03:39 +0200
X-Failed-Recipients: xxxx@xxxx.net
Auto-Submitted: auto-replied
From: Mail Delivery System <Mailer-Daemon@xxxx.xxxx.net>
To: xxxx@xxxx.net
Subject: xxxx.xxxx.net Mail delivery failed : returning message to sender
Message-Id: <E1kSH9f-0005xf-18@xxxx.xxxx.net>
Date: Tue, 13 Oct 2020 12:03:39 +0200

This message was created automatically by the SMTP relay on xxxx.xxxx.net.

A message that you sent could not be delivered to all of its recipients.
The following address(es) failed:

xxxx@xxxx.net
SMTP error from remote mail server after RCPT TO:<xxxx@xxxx.net>:
host 192.0.2.22 [192.0.2.22]: 550 5.1.1 <xxxx@xxxx.net>:
Recipient address rejected: User unknown in local recipient table

------ This is a copy of the message, including all the headers. ------

Return-path: <xxxx@xxxx.net>
Received: from xxxx.xxxx.net
by xxxx.xxxx.net with esmtp (Exim 4.82_1-5b7a7c0-XX)
(envelope-from <xxxx@xxxx.net>)
id 1kSH9d-0005pw-05
for xxxx@xxxx.net; Tue, 13 Oct 2020 12:03:37 +0200
Message-Id: <1602583415.xxxx@xxxx.net>
Feedback-Id: 52:1930
To: xxxx@xxxx.net
Reply-To: newsletter@xxxx.net
Content-Type: text/html; charset=utf-8
53 changes: 53 additions & 0 deletions set-of-emails/maildir/bsd/lhost-x3-06.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Return-Path: <>
X-Original-To: xxxx@xxxx.net
Delivered-To: xxxx@xxxx.xxxx.net
Received: from xxxx.xxxx.net (xxxx.xxxx.net)
by xxxx.xxxx.net (Postfix) with ESMTP id ED7AF2036798
for <xxxx@xxxx.net>; Tue, 13 Oct 2020 11:24:06 +0200 (CEST)
Date: Tue, 13 Oct 2020 11:24:06 +0200
From: Mail Delivery System <mailer-daemon@xxxx.xxxx.net>
To: xxxx@xxxx.net
Subject: Delivery status notification
MIME-Version: 1.0
Content-Type: multipart/report; boundary="------------I305M09060309060P_556516025810460"

This is a multi-part message in MIME format.

--------------I305M09060309060P_556516025810460
Content-Type: text/plain; charset=UTF-8;
Content-Transfer-Encoding: 8bit
This is an automatically generated Delivery Status Notification.
Delivery to the following recipients was aborted after 0 second(s):
* xxxx@xxxx.net
--------------I305M09060309060P_556516025810460
Content-Type: message/delivery-status; charset=UTF-8;
Content-Transfer-Encoding: 8bit
Reporting-MTA: dns; xxxx.xxxx.net
Received-From-MTA: dns; xxxx.xxxx.net
Arrival-Date: Tue, 13 Oct 2020 11:24:06 +0200
Final-recipient: rfc822; xxxx@xxxx.net
Action: failed
Status: 5.1.1
Diagnostic-Code: smtp; 552 5.2.2 Over quota
Last-attempt-Date: Tue, 13 Oct 2020 11:24:06 +0200
--------------I305M09060309060P_556516025810460
Content-Type: text/rfc822-headers; Content-Transfer-Encoding: 8bit
Content-Disposition: attachment
xxxx
--------------I305M09060309060P_556516025810460--


2 changes: 1 addition & 1 deletion t/022-mail-maildir.t
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ my $MethodNames = {
'class' => ['new'],
'object' => ['path', 'dir', 'file', 'size', 'offset', 'handle', 'read'],
};
my $MaildirSize = 489;
my $MaildirSize = 491;
my $SampleEmail = './set-of-emails/maildir/bsd';
my $NewInstance = $PackageName->new($SampleEmail);

Expand Down
1 change: 1 addition & 0 deletions t/618-lhost-exim.t
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ my $isexpected = [
{ 'n' => '58', 's' => qr/\A5[.]0[.]\d+\z/, 'r' => qr/mesgtoobig/, 'b' => qr/\A1\z/ },
{ 'n' => '59', 's' => qr/\A5[.]1[.]1\z/, 'r' => qr/userunknown/, 'b' => qr/\A0\z/ },
{ 'n' => '60', 's' => qr/\A5[.]0[.]0\z/, 'r' => qr/mailboxfull/, 'b' => qr/\A1\z/ },
{ 'n' => '61', 's' => qr/\A5[.]1[.]1\z/, 'r' => qr/userunknown/, 'b' => qr/\A0\z/ },
];

$enginetest->($enginename, $isexpected);
Expand Down
1 change: 1 addition & 0 deletions t/673-lhost-x3.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ my $isexpected = [
{ 'n' => '02', 's' => qr/\A5[.]0[.]\d+\z/, 'r' => qr/expired/, 'b' => qr/\A1\z/ },
{ 'n' => '03', 's' => qr/\A5[.]3[.]0\z/, 'r' => qr/userunknown/, 'b' => qr/\A0\z/ },
{ 'n' => '05', 's' => qr/\A5[.]0[.]\d+\z/, 'r' => qr/undefined/, 'b' => qr/\A1\z/ },
{ 'n' => '06', 's' => qr/\A5[.]2[.]\d+\z/, 'r' => qr/mailboxfull/, 'b' => qr/\A1\z/ },
];

$enginetest->($enginename, $isexpected);
Expand Down

0 comments on commit 840ed85

Please sign in to comment.