Skip to content

Commit

Permalink
#288 Implement Sisimai::Rhost::YahooInc
Browse files Browse the repository at this point in the history
  • Loading branch information
azumakuniyuki committed Jun 2, 2024
1 parent fe02afe commit 99c3f1e
Show file tree
Hide file tree
Showing 5 changed files with 401 additions and 0 deletions.
102 changes: 102 additions & 0 deletions lib/sisimai/rhost/yahooinc.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
module Sisimai
module Rhost
# Sisimai::Rhost detects the bounce reason from the content of Sisimai::Fact object as an argument
# of get() method when the value of "destination" of the object is "*.yahoodns.net".
# This class is called only Sisimai::Fact class.
module YahooInc
class << self
MessagesOf = {
'authfailure' => [
# - 550 5.7.9 This mail has been blocked because the sender is unauthenticated. Yahoo
# requires all senders to authenticate with either SPF or DKIM.
'yahoo requires all senders to authenticate with either spf or dkim',
],
'badreputation' => [
# - 421 4.7.0 [TSS04] Messages from 192.0.2.25 temporarily deferred due to unexpected
# volume or user complaints - 4.16.55.1;
# see https://postmaster.yahooinc.com/error-codes (in reply to MAIL FROM command))
'temporarily deferred due to unexpected volume or user complaints',
],
'blocked' => [
# - 553 5.7.1 [BL21] Connections will not be accepted from 192.0.2.25,
# because the ip is in Spamhaus's list; see http://postmaster.yahoo.com/550-bl23.html
# - 553 5.7.1 [BL23] Connections not accepted from IP addresses on Spamhaus XBL;
# see http://postmaster.yahoo.com/errors/550-bl23.html [550]",
" because the ip is in spamhaus's list;",
'not accepted from ip addresses on spamhaus xbl',
],
'norelaying' => [
# - 550 relaying denied for <***@yahoo.com>
'relaying denied for ',
],
'notcomplaintrfc' => ['headers are not rfc compliant'],
'policyviolation' => [
# - 554 Message not allowed - [PH01] Email not accepted for policy reasons.
# Please visit https://postmaster.yahooinc.com/error-codes
# - 554 5.7.9 Message not accepted for policy reasons.
# See https://postmaster.yahooinc.com/error-codes
'not accepted for policy reasons',
],
'rejected' => [
# - 553 5.7.2 [TSS09] All messages from 192.0.2.25 will be permanently deferred;
# Retrying will NOT succeed. See https://postmaster.yahooinc.com/error-codes
# - 553 5.7.2 [TSS11] All messages from 192.0.2.25 will be permanently deferred;
# Retrying will NOT succeed. See https://postmaster.yahooinc.com/error-codes
' will be permanently deferred',
],
'speeding' => [
# - 450 User is receiving mail too quickly
'User is receiving mail too quickly',
],
'suspend' => [
# - 554 delivery error: dd ****@yahoo.com is no longer valid.
# - 554 30 Sorry, your message to *****@aol.jp cannot be delivered.
# This mailbox is disabled (554.30)
' is no longer valid.',
'This mailbox is disabled',
],
'syntaxerror' => [
# - 501 Syntax error in parameters or arguments
'syntax error in parameters or arguments',
],
'toomanyconn' => [
# - 421 Max message per connection reached, closing transmission channel
'max message per connection reached',
],
'userunknown' => [
# - 554 delivery error: dd This user doesn't have a yahoo.com account (***@yahoo.com)
# - 552 1 Requested mail action aborted, mailbox not found (in reply to end of DATA command)
"dd this user doesn't have a ",
'mailbox not found',
],
}.freeze

# Detect bounce reason from Yahoo Inc. (*.yahoodns.net)
# @param [Sisimai::Fact] argvs Parsed email object
# @return [String] The bounce reason for YahooInc
# @see https://senders.yahooinc.com/smtp-error-codes
# https://smtpfieldmanual.com/provider/yahoo
# https://www.postmastery.com/yahoo-postmaster/
def get(argvs)
return argvs['reason'] unless argvs['reason'].empty?

issuedcode = argvs['diagnosticcode'].downcase
reasontext = ''

MessagesOf.each_key do |e|
MessagesOf[e].each do |f|
next unless issuedcode.include?(f)
reasontext = e
break
end
break if reasontext.size > 0
end

return reasontext
end

end
end
end
end

80 changes: 80 additions & 0 deletions set-of-emails/maildir/bsd/rhost-yahooinc-01.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--
83 changes: 83 additions & 0 deletions set-of-emails/maildir/bsd/rhost-yahooinc-02.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
Return-Path: <>
Delivered-To: [email protected]
Received: from u1.em.example.jp
by mbox3.em.example.jp with LMTP id pRi6D904298QQXvAukD22R
for <[email protected]>; Tue, 17 Nov 2020 23:34:45 +0900
Received: by u1.em.example.jp (Postfix)
id 9UKnCx1J50z3ZQ2; Tue, 17 Nov 2020 23:34:45 +0900 (JST)
Date: Tue, 17 Nov 2020 23:34:45 +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="9UK8Prr4eZzSPQR.1605555025/u1.em.example.jp"
Message-Id: <[email protected]>

This is a MIME-encapsulated message.

--9UK8Prr4eZzSPQR.1605555025/u1.em.example.jp
Content-Description: Notification
Content-Type: text/plain; charset=us-ascii
This is the mail system at host u1.em.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 mta6.am0.yahoodns.net[67.195.204.72] said: 421
4.7.0 [TSS04] Messages from 192.0.2.192 temporarily deferred due to
unexpected volume or user complaints - 4.16.55.1; see
https://postmaster.verizonmedia.com/error-codes (in reply to MAIL FROM
command)
--9UK8Prr4eZzSPQR.1605555025/u1.em.example.jp
Content-Description: Delivery report
Content-Type: message/delivery-status
Reporting-MTA: dns; u1.em.example.jp
X-Postfix-Queue-ID: 9UK8Prr4eZzSPQR
X-Postfix-Sender: rfc822; [email protected]
Arrival-Date: Mon, 16 Nov 2020 23:34:45 +0900 (JST)
Final-Recipient: rfc822; [email protected]
Original-Recipient: rfc822;[email protected]
Action: failed
Status: 4.7.0
Remote-MTA: dns; mta6.am0.yahoodns.net
Diagnostic-Code: smtp; 421 4.7.0 [TSS04] Messages from 192.0.2.192
temporarily deferred due to unexpected volume or user complaints -
4.16.55.1; see https://postmaster.verizonmedia.com/error-codes
--9UK8Prr4eZzSPQR.1605555025/u1.em.example.jp
Content-Description: Undelivered Message
Content-Type: message/rfc822
Return-Path: <[email protected]>
Received: from u1.em.example.jp (localhost [127.0.0.1])
by u1.em.example.jp (Postfix) with ESMTP id 9UK8Prr4eZzSPQR
for <[email protected]>; Mon, 16 Nov 2020 23:34:45 +0900 (JST)
Received: from localhost (localhost [127.0.0.1])
by u1.em.example.jp (Postfix) with ESMTP id 9UK8P757b8z3ZQM
for <[email protected]>; Mon, 16 Nov 2020 23:34:45 +0900 (JST)
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-2022-JP
Content-Transfer-Encoding: quoted-printable
From: <[email protected]>
To: "Kijitora" <[email protected]>
Subject: Nyaan
Message-Id: <[email protected]>
Date: Mon, 16 Nov 2020 23:34:45 +0900 (JST)
X-Virus-Scanned: ClamAV using ClamSMTP
Nyaan
--9UK8Prr4eZzSPQR.1605555025/u1.em.example.jp--
125 changes: 125 additions & 0 deletions set-of-emails/maildir/bsd/rhost-yahooinc-03.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
Return-Path: <>
Received: from mx2.example.jp (mx2.example.jp [192.0.2.222])
by aneyakoji.example.co.jp (V8/cf) with ESMTP id u8CJoVRB027731
for <[email protected]>; Tue, 13 Sep 2016 04:50:33 +0900
X-SenderID: Sendmail Sender-ID Filter v1.0.0 aneyakoji.example.co.jp u8CJoVRB027731
Authentication-Results: aneyakoji.example.co.jp; sender-id=none header.from=[email protected]
Received: from localhost (localhost)
by mx2.example.jp (V8/cf) id u8CJoQN4016081;
Tue, 13 Sep 2016 04:50:33 +0900
Date: Tue, 13 Sep 2016 04:50:33 +0900
From: Mail Delivery Subsystem <[email protected]>
Message-Id: <[email protected]>
To: [email protected]
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="u8CJoQN4016081.1473709833/mx2.example.jp"
Subject: Postmaster notify: see transcript for details
Auto-Submitted: auto-generated (postmaster-notification)

This is a MIME-encapsulated message

--u8CJoQN4016081.1473709833/mx2.example.jp

The original message was received at Tue, 13 Sep 2016 04:50:26 +0900
from localhost
with id u8CJoQN3016081

----- The following addresses had permanent fatal errors -----
<[email protected]>
(reason: 554 delivery error: dd This user doesn't have a yahoo.com account ([email protected]) [0] - mta1061.mail.ne1.yahoo.com)

----- Transcript of session follows -----
... while talking to mta6.am0.yahoodns.net.:
>>> DATA
<<< 554 delivery error: dd This user doesn't have a yahoo.com account ([email protected]) [0] - mta1061.mail.ne1.yahoo.com
554 5.0.0 Service unavailable

--u8CJoQN4016081.1473709833/mx2.example.jp
Content-Type: message/delivery-status
Reporting-MTA: dns; mx2.example.jp
Received-From-MTA: DNS; FF00FFFF.static.example.org
Arrival-Date: Tue, 13 Sep 2016 04:50:26 +0900
Final-Recipient: RFC822; [email protected]
Action: failed
Status: 5.0.0
Remote-MTA: DNS; mta6.am0.yahoodns.net
Diagnostic-Code: SMTP; 554 delivery error: dd This user doesn't have a yahoo.com account ([email protected]) [0] - mta1061.mail.ne1.yahoo.com
Last-Attempt-Date: Tue, 13 Sep 2016 04:50:30 +0900
--u8CJoQN4016081.1473709833/mx2.example.jp
Content-Type: message/rfc822
Return-Path: <MAILER-DAEMON>
Received: from localhost (localhost)
by mx2.example.jp (V8/cf) id u8CJoQN3016081;
Tue, 13 Sep 2016 04:50:26 +0900
Date: Tue, 13 Sep 2016 04:50:26 +0900
From: Mail Delivery Subsystem <MAILER-DAEMON>
Message-Id: <[email protected]>
To: <[email protected]>
To: postmaster
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="u8CJoQN3016081.1473709826/mx2.example.jp"
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)
This is a MIME-encapsulated message
--u8CJoQN3016081.1473709826/mx2.example.jp

...

--u8CJoQN3016081.1473709826/mx2.example.jp
Content-Type: message/delivery-status
Reporting-MTA: dns; mx2.example.jp
Received-From-MTA: DNS; FF00FFFF.static.example.org
Arrival-Date: Tue, 13 Sep 2016 04:50:25 +0900
Original-Recipient: rfc822;[email protected]
Final-Recipient: RFC822; [email protected]
Action: failed
Status: 5.3.5
Diagnostic-Code: SMTP; 553 5.3.5 system config error
Last-Attempt-Date: Tue, 13 Sep 2016 04:50:26 +0900
--u8CJoQN3016081.1473709826/mx2.example.jp
Content-Type: message/rfc822
Return-Path: <[email protected]>
Received: from mx.smtp.example.net (FF00FFFF.static.example.org [198.51.100.22])
by mx2.example.jp (V8/cf) with ESMTP id u8CJoPN3016079
for <[email protected]>; Tue, 13 Sep 2016 04:50:25 +0900
Message-Id: <[email protected]>
Received: from User (unknown [203.0.113.2])
(Authenticated sender: server)
by mx.smtp.example.net (Postfix) with ESMTPA id 23EC336A7E;
Mon, 12 Sep 2016 13:35:38 +0200 (CEST)
Reply-To: <[email protected]>
From: "NON-EXISTENT" <[email protected]>
Subject: Nyaan
Date: Mon, 12 Sep 2016 13:35:46 +0200
MIME-Version: 1.0
Content-Type: text/html;
charset="Windows-1251"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
To: undisclosed-recipients:;
<HTML><HEAD><TITLE></TITLE>
</HEAD>
<BODY bgcolor=#FFFFFF leftmargin=5 topmargin=5 rightmargin=5 bottommargin=5>
</BODY></HTML>
--u8CJoQN3016081.1473709826/mx2.example.jp--


--u8CJoQN4016081.1473709833/mx2.example.jp--

Loading

0 comments on commit 99c3f1e

Please sign in to comment.