Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for DMARC related bounces #418

Merged
merged 9 commits into from
Nov 17, 2020
11 changes: 3 additions & 8 deletions lib/Sisimai/Lhost/Postfix.pm
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ sub make {
# The mail system
#
# <[email protected]>: host mx.example.co.jp[192.0.2.153] said: 550
# 5.1.1 <[email protected]>... User Unknown (in reply to RCPT TO
# command)
# 5.1.1 <[email protected]>... User Unknown (in reply to RCPT TO command)
if( index($p, 'Diagnostic-Code:') == 0 && $e =~ /\A[ \t]+(.+)\z/ ) {
# Continued line of the value of Diagnostic-Code header
$v->{'diagnosis'} .= ' '.$1;
Expand All @@ -126,16 +125,12 @@ sub make {

} else {
# Alternative error message and recipient
if( $e =~ /[ \t][(]in reply to ([A-Z]{4}).*/ ) {
if( $e =~ /[ \t][(]in reply to (?:end of )?([A-Z]{4}).*/ ||
$e =~ /([A-Z]{4})[ \t]*.*command[)]\z/ ) {
# 5.1.1 <[email protected]>... User Unknown (in reply to RCPT TO
push @commandset, $1;
$anotherset->{'diagnosis'} .= ' '.$e if $anotherset->{'diagnosis'};

} elsif( $e =~ /([A-Z]{4})[ \t]*.*command[)]\z/ ) {
# to MAIL command)
push @commandset, $1;
$anotherset->{'diagnosis'} .= ' '.$e if $anotherset->{'diagnosis'};

} elsif( $e =~ /\A[<]([^ ]+[@][^ ]+)[>] [(]expanded from [<](.+)[>][)]:[ \t]*(.+)\z/ ) {
# <[email protected]> (expanded from <[email protected]>): user ...
$anotherset->{'recipient'} = $1;
Expand Down
3 changes: 2 additions & 1 deletion lib/Sisimai/Reason/PolicyViolation.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ sub match {
'because the recipient is not accepting mail with ', # AOL Phoenix
'closed mailing list',
'denied by policy',
'dmarc policy',
'email not accepted for policy reasons',
# http://kb.mimecast.com/Mimecast_Knowledge_Base/Administration_Console/Monitoring/Mimecast_SMTP_Error_Codes#554
'email rejected due to security policies',
Expand Down Expand Up @@ -103,7 +104,7 @@ azumakuniyuki

=head1 COPYRIGHT

Copyright (C) 2017-2019 azumakuniyuki, All rights reserved.
Copyright (C) 2017-2020 azumakuniyuki, All rights reserved.

=head1 LICENSE

Expand Down
5 changes: 4 additions & 1 deletion lib/Sisimai/Rhost/GoogleApps.pm
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ sub get {
'Messages with multiple addresses in From: header are not accepted.',
'The user or domain that you are sending to (or from) has a policy',
]},
{ 'reason' => 'rejected', 'string' => ['Unauthenticated email is not accepted from this domain.'] },
{ 'reason' => 'rejected', 'string' => [
'This message does not have authentication information or fails to pass authentication checks',
'Unauthenticated email is not accepted from this domain.'
] },
],
'X.7.4' => [{ 'reason' => 'syntaxerror', 'string' => ['Unrecognized Authentication Type.'] }],
};
Expand Down
80 changes: 80 additions & 0 deletions set-of-emails/maildir/bsd/lhost-postfix-66.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
Return-Path: <>
Received: from mbox.example.jp (mail.example.jp [192.0.2.48])
by mx.example.jp (V8/cf) with ESMTP id 0AD0mYaG000334
for <[email protected]>; Fri, 13 Nov 2020 09:48:34 +0900
Received: from mbox.example.jp (localhost [127.0.0.1])
by mbox.example.jp (Postfix) with ESMTP id 4CXKb61hkLz22xZY
for <[email protected]>; Fri, 13 Nov 2020 09:48:34 +0900 (JST)
Received: from smtp.example.jp (smtp.example.jp [203.0.113.113])
by mbox.example.jp (Postfix) with ESMTP id 4CXKb61FPyz1yM4D
for <[email protected]>; Fri, 13 Nov 2020 09:48:34 +0900 (JST)
Received: by smtp.example.jp (Postfix)
id 056C3D244EC; Fri, 13 Nov 2020 09:48:34 +0900 (JST)
Date: Fri, 13 Nov 2020 09:48:34 +0900 (JST)
From: [email protected] (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: [email protected]
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="08513C0196A.1605228514/smtp.example.jp"
Message-Id: <[email protected]>
X-Virus-Scanned: ClamAV using ClamSMTP

This is a MIME-encapsulated message.

--08513C0196A.1605228514/smtp.example.jp
Content-Description: Notification
Content-Type: text/plain; charset=us-ascii

This is the mail system at host smtp.example.jp.

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

<[email protected]>: host mx-aol.mail.gm0.yahoodns.net[67.195.204.80] said:
554 5.7.9 Message not accepted for policy reasons. See
https://postmaster.verizonmedia.com/error-codes (in reply to end of DATA
command)

--08513C0196A.1605228514/smtp.example.jp
Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; smtp.example.jp
X-Postfix-Queue-ID: 08513C0196A
X-Postfix-Sender: rfc822; [email protected]
Arrival-Date: Fri, 13 Nov 2020 09:47:59 +0900 (JST)

Final-Recipient: rfc822; [email protected]
Original-Recipient: rfc822;[email protected]
Action: failed
Status: 5.7.9
Remote-MTA: dns; mx-aol.mail.gm0.yahoodns.net
Diagnostic-Code: smtp; 554 5.7.9 Message not accepted for policy reasons. See
https://postmaster.verizonmedia.com/error-codes

--08513C0196A.1605228514/smtp.example.jp
Content-Description: Undelivered Message
Content-Type: message/rfc822

Return-Path: <[email protected]>
Received: from [127.0.0.1] (localhost [127.0.0.1])
by smtp.example.jp (Postfix) with ESMTP id 08513C0196A
for <[email protected]>; Fri, 13 Nov 2020 09:47:59 +0900 (JST)
From: [email protected]
Subject: TEST FOR DMARC #7
To: [email protected]
Message-Id: <[email protected]>
Date: Fri, 13 Nov 2020 09:47:59 +0900 (JST)

Nyaan

--08513C0196A.1605228514/smtp.example.jp--
80 changes: 80 additions & 0 deletions set-of-emails/maildir/bsd/lhost-postfix-67.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
Return-Path: <>
Received: from mbox.example.jp (mail.example.jp [192.0.2.48])
by mx.example.jp (V8/cf) with ESMTP id 0AD0ngL7000414
for <[email protected]>; Fri, 13 Nov 2020 09:49:43 +0900
Received: from mbox.example.jp (localhost [127.0.0.1])
by mbox.example.jp (Postfix) with ESMTP id 4CXKcQ60rGz22xZY
for <[email protected]>; Fri, 13 Nov 2020 09:49:42 +0900 (JST)
Received: from smtp.example.jp (smtp.example.jp [203.0.113.113])
by mbox.example.jp (Postfix) with ESMTP id 4CXKcQ5YPpz1yM4D
for <[email protected]>; Fri, 13 Nov 2020 09:49:42 +0900 (JST)
Received: by smtp.example.jp (Postfix)
id ADEACD244EC; Fri, 13 Nov 2020 09:49:42 +0900 (JST)
Date: Fri, 13 Nov 2020 09:49:42 +0900 (JST)
From: [email protected] (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: [email protected]
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="B5693C0196A.1605228582/smtp.example.jp"
Message-Id: <[email protected]>
X-Virus-Scanned: ClamAV using ClamSMTP

This is a MIME-encapsulated message.

--B5693C0196A.1605228582/smtp.example.jp
Content-Description: Notification
Content-Type: text/plain; charset=us-ascii

This is the mail system at host smtp.example.jp.

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

<[email protected]>: host mx-aol.mail.gm0.yahoodns.net[67.195.228.84] said:
554 5.7.9 Message not accepted for policy reasons. See
https://postmaster.verizonmedia.com/error-codes (in reply to end of DATA
command)

--B5693C0196A.1605228582/smtp.example.jp
Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; smtp.example.jp
X-Postfix-Queue-ID: B5693C0196A
X-Postfix-Sender: rfc822; [email protected]
Arrival-Date: Fri, 13 Nov 2020 09:49:11 +0900 (JST)

Final-Recipient: rfc822; [email protected]
Original-Recipient: rfc822;[email protected]
Action: failed
Status: 5.7.9
Remote-MTA: dns; mx-aol.mail.gm0.yahoodns.net
Diagnostic-Code: smtp; 554 5.7.9 Message not accepted for policy reasons. See
https://postmaster.verizonmedia.com/error-codes

--B5693C0196A.1605228582/smtp.example.jp
Content-Description: Undelivered Message
Content-Type: message/rfc822

Return-Path: <[email protected]>
Received: from [127,0.0.1] (localhost [127.0.0.1])
by smtp.example.jp (Postfix) with ESMTP id B5693C0196A
for <[email protected]>; Fri, 13 Nov 2020 09:49:11 +0900 (JST)
Subject: TEST FOR DMARC #8
From: [email protected]
To: [email protected]
Message-Id: <[email protected]>
Date: Fri, 13 Nov 2020 09:49:11 +0900 (JST)

Nyaan

--B5693C0196A.1605228582/smtp.example.jp--
82 changes: 82 additions & 0 deletions set-of-emails/maildir/bsd/lhost-postfix-68.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
Return-Path: <>
Received: from mbox.example.jp (mail.example.jp [192.0.2.48])
by mx.example.jp (V8/cf) with ESMTP id 0AD0ifMd032580
for <[email protected]>; Fri, 13 Nov 2020 09:44:41 +0900
Received: from mbox.example.jp (localhost [127.0.0.1])
by mbox.example.jp (Postfix) with ESMTP id 4CXKVd39fRz22xZY
for <[email protected]>; Fri, 13 Nov 2020 09:44:41 +0900 (JST)
Received: from smtp.example.jp (smtp.example.jp [203.0.113.113])
by mbox.example.jp (Postfix) with ESMTP id 4CXKVd2kxmz1yM4D
for <[email protected]>; Fri, 13 Nov 2020 09:44:41 +0900 (JST)
Received: by smtp.example.jp (Postfix)
id 3101DD244EC; Fri, 13 Nov 2020 09:44:41 +0900 (JST)
Date: Fri, 13 Nov 2020 09:44:41 +0900 (JST)
From: [email protected] (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: [email protected]
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="48C62C0196A.1605228281/smtp.example.jp"
Message-Id: <[email protected]>
X-Virus-Scanned: ClamAV using ClamSMTP

This is a MIME-encapsulated message.

--48C62C0196A.1605228281/smtp.example.jp
Content-Description: Notification
Content-Type: text/plain; charset=us-ascii

This is the mail system at host smtp.example.jp.

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

<[email protected]>: host mx2.mail.yahoo.co.jp[202.93.66.118] said: 554
Message not allowed - 554 Message not allowed - DM Email not accepted for
policy reasons. Please visit
https://www.yahoo-help.jp/app/answers/detail/a_id/80870/p/622 [895] (in
reply to end of DATA command)

--48C62C0196A.1605228281/smtp.example.jp
Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; smtp.example.jp
X-Postfix-Queue-ID: 48C62C0196A
X-Postfix-Sender: rfc822; [email protected]
Arrival-Date: Fri, 13 Nov 2020 09:44:12 +0900 (JST)

Final-Recipient: rfc822; [email protected]
Original-Recipient: rfc822;[email protected]
Action: failed
Status: 5.0.0
Remote-MTA: dns; mx2.mail.yahoo.co.jp
Diagnostic-Code: smtp; 554 Message not allowed - 554 Message not allowed - DM
Email not accepted for policy reasons. Please visit
https://www.yahoo-help.jp/app/answers/detail/a_id/80870/p/622 [895]

--48C62C0196A.1605228281/smtp.example.jp
Content-Description: Undelivered Message
Content-Type: message/rfc822

Return-Path: <[email protected]>
Received: from [127.0.0.1] (localhost [127.0.0.1])
by smtp.example.jp (Postfix) with ESMTP id 48C62C0196A
for <[email protected]>; Fri, 13 Nov 2020 09:44:12 +0900 (JST)
Subject: TEST FOR DMARC #3
From: [email protected]
To: [email protected]
Message-Id: <[email protected]>
Date: Fri, 13 Nov 2020 09:44:12 +0900 (JST)

Nyaan

--48C62C0196A.1605228281/smtp.example.jp--
80 changes: 80 additions & 0 deletions set-of-emails/maildir/bsd/lhost-postfix-69.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
Return-Path: <>
Received: from mbox.example.jp (mail.example.jp [192.0.2.48])
by mx.example.jp (V8/cf) with ESMTP id 0AD0i4HY032532
for <[email protected]>; Fri, 13 Nov 2020 09:44:04 +0900
Received: from mbox.example.jp (localhost [127.0.0.1])
by mbox.example.jp (Postfix) with ESMTP id 4CXKTw02Xtz22xZY
for <[email protected]>; Fri, 13 Nov 2020 09:44:04 +0900 (JST)
Received: from smtp.example.jp (smtp.example.jp [203.0.113.113])
by mbox.example.jp (Postfix) with ESMTP id 4CXKTv6hp1z1yM4D
for <[email protected]>; Fri, 13 Nov 2020 09:44:03 +0900 (JST)
Received: by smtp.example.jp (Postfix)
id A4D0FD244EC; Fri, 13 Nov 2020 09:44:03 +0900 (JST)
Date: Fri, 13 Nov 2020 09:44:03 +0900 (JST)
From: [email protected] (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: [email protected]
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="2041FC0196A.1605228243/smtp.example.jp"
Message-Id: <[email protected]>
X-Virus-Scanned: ClamAV using ClamSMTP

This is a MIME-encapsulated message.

--2041FC0196A.1605228243/smtp.example.jp
Content-Description: Notification
Content-Type: text/plain; charset=us-ascii

This is the mail system at host smtp.example.jp.

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

<[email protected]>: host mta5.am0.yahoodns.net[67.195.204.73] said: 554
5.7.9 Message not accepted for policy reasons. See
https://postmaster.verizonmedia.com/error-codes (in reply to end of DATA
command)

--2041FC0196A.1605228243/smtp.example.jp
Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; smtp.example.jp
X-Postfix-Queue-ID: 2041FC0196A
X-Postfix-Sender: rfc822; [email protected]
Arrival-Date: Fri, 13 Nov 2020 09:43:26 +0900 (JST)

Final-Recipient: rfc822; [email protected]
Original-Recipient: rfc822;[email protected]
Action: failed
Status: 5.7.9
Remote-MTA: dns; mta5.am0.yahoodns.net
Diagnostic-Code: smtp; 554 5.7.9 Message not accepted for policy reasons. See
https://postmaster.verizonmedia.com/error-codes

--2041FC0196A.1605228243/smtp.example.jp
Content-Description: Undelivered Message
Content-Type: message/rfc822

Return-Path: <[email protected]>
Received: from [127.0.0.1] (localhost [127.0.0.1])
by smtp.example.jp (Postfix) with ESMTP id 2041FC0196A
for <[email protected]>; Fri, 13 Nov 2020 09:43:26 +0900 (JST)
Subject: TEST FOR DMARC #2
From: [email protected]
To: [email protected]
Message-Id: <[email protected]>
Date: Fri, 13 Nov 2020 09:43:26 +0900 (JST)

Nyaan

--2041FC0196A.1605228243/smtp.example.jp--
Loading