Skip to content

Commit

Permalink
Merge pull request #418 from sisimai/dmarc-failure-is-policy-violation
Browse files Browse the repository at this point in the history
Updates for DMARC related bounces
  • Loading branch information
azumakuniyuki authored Nov 17, 2020
2 parents 75b43c9 + fa10826 commit de0befe
Show file tree
Hide file tree
Showing 18 changed files with 826 additions and 12 deletions.
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
#
# <userunknown@example.co.jp>: host mx.example.co.jp[192.0.2.153] said: 550
# 5.1.1 <userunknown@example.co.jp>... User Unknown (in reply to RCPT TO
# command)
# 5.1.1 <userunknown@example.co.jp>... 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 <userunknown@example.co.jp>... 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/ ) {
# <r@example.ne.jp> (expanded from <kijitora@example.org>): 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 <postmaster@example.jp>; 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 <postmaster@sisimai.example.com>; 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 <postmaster@sisimai.example.com>; 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: MAILER-DAEMON@smtp.example.jp (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: postmaster@sisimai.example.com
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="08513C0196A.1605228514/smtp.example.jp"
Message-Id: <20201113004834.056C3D244EC@smtp.example.jp>
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
<kijitora@aol.example.jp>: 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; postmaster@sisimai.example.com
Arrival-Date: Fri, 13 Nov 2020 09:47:59 +0900 (JST)
Final-Recipient: rfc822; kijitora@aol.example.jp
Original-Recipient: rfc822;kijitora@aol.example.jp
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: <postmaster@sisimai.example.com>
Received: from [127.0.0.1] (localhost [127.0.0.1])
by smtp.example.jp (Postfix) with ESMTP id 08513C0196A
for <kijitora@aol.example.jp>; Fri, 13 Nov 2020 09:47:59 +0900 (JST)
From: postmaster@libsisimai.org
Subject: TEST FOR DMARC #7
To: kijitora@aol.example.jp
Message-Id: <20201113004812.08513C0196A@smtp.example.jp>
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 <postmaster@example.jp>; 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 <postmaster@sisimai.example.com>; 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 <postmaster@sisimai.example.com>; 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: MAILER-DAEMON@smtp.example.jp (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: postmaster@sisimai.example.com
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="B5693C0196A.1605228582/smtp.example.jp"
Message-Id: <20201113004942.ADEACD244EC@smtp.example.jp>
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
<kijitora@aol.example.jp>: 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; postmaster@sisimai.example.com
Arrival-Date: Fri, 13 Nov 2020 09:49:11 +0900 (JST)
Final-Recipient: rfc822; kijitora@aol.example.jp
Original-Recipient: rfc822;kijitora@aol.example.jp
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: <postmaster@sisimai.example.com>
Received: from [127,0.0.1] (localhost [127.0.0.1])
by smtp.example.jp (Postfix) with ESMTP id B5693C0196A
for <kijitora@aol.example.jp>; Fri, 13 Nov 2020 09:49:11 +0900 (JST)
Subject: TEST FOR DMARC #8
From: postmaster@libsisimai.org
To: kijitora@aol.example.jp
Message-Id: <20201113004922.B5693C0196A@smtp.example.jp>
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 <postmaster@example.jp>; 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 <postmaster@sisimai.example.com>; 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 <postmaster@sisimai.example.com>; 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: MAILER-DAEMON@smtp.example.jp (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: postmaster@sisimai.example.com
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="48C62C0196A.1605228281/smtp.example.jp"
Message-Id: <20201113004441.3101DD244EC@smtp.example.jp>
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
<kijitora@yahoo.example.co.jp>: 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; postmaster@sisimai.example.com
Arrival-Date: Fri, 13 Nov 2020 09:44:12 +0900 (JST)
Final-Recipient: rfc822; kijitora@yahoo.example.co.jp
Original-Recipient: rfc822;kijitora@yahoo.example.co.jp
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: <postmaster@sisimai.example.com>
Received: from [127.0.0.1] (localhost [127.0.0.1])
by smtp.example.jp (Postfix) with ESMTP id 48C62C0196A
for <kijitora@yahoo.example.co.jp>; Fri, 13 Nov 2020 09:44:12 +0900 (JST)
Subject: TEST FOR DMARC #3
From: postmaster@libsisimai.org
To: kijitora@yahoo.example.co.jp
Message-Id: <20201113004420.48C62C0196A@smtp.example.jp>
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 <postmaster@example.jp>; 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 <postmaster@sisimai.example.com>; 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 <postmaster@sisimai.example.com>; 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: MAILER-DAEMON@smtp.example.jp (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: postmaster@sisimai.example.com
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="2041FC0196A.1605228243/smtp.example.jp"
Message-Id: <20201113004403.A4D0FD244EC@smtp.example.jp>
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
<kijitora@yahoo.example.com>: 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; postmaster@sisimai.example.com
Arrival-Date: Fri, 13 Nov 2020 09:43:26 +0900 (JST)
Final-Recipient: rfc822; kijitora@yahoo.example.com
Original-Recipient: rfc822;kijitora@yahoo.example.com
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: <postmaster@sisimai.example.com>
Received: from [127.0.0.1] (localhost [127.0.0.1])
by smtp.example.jp (Postfix) with ESMTP id 2041FC0196A
for <kijitora@yahoo.example.com>; Fri, 13 Nov 2020 09:43:26 +0900 (JST)
Subject: TEST FOR DMARC #2
From: postmaster@libsisimai.org
To: kijitora@yahoo.example.com
Message-Id: <20201113004335.2041FC0196A@smtp.example.jp>
Date: Fri, 13 Nov 2020 09:43:26 +0900 (JST)
Nyaan
--2041FC0196A.1605228243/smtp.example.jp--
Loading

0 comments on commit de0befe

Please sign in to comment.