| 1 | package Sisimai::Rhost::YahooIncscip-perl cpan Sisimai v5.7.0 Sisimai/Rhost/YahooInc/; |
| 2 | use v5.26scip-perl cpan Sisimai v5.7.0 `v5.26`/; |
| 3 | use strictscip-perl cpan Sisimai v5.7.0 strict/; |
| 4 | use warningsscip-perl cpan Sisimai v5.7.0 warnings/; |
| 5 | |
| 6 | sub findscip-perl cpan Sisimai v5.7.0 Sisimai/Rhost/YahooInc/find(). { |
| 7 | # Detect bounce reason from Yahoo Inc. (*.yahoodns.net) |
| 8 | # @param [Sisimai::Fact] argvs Decoded email object |
| 9 | # @return [String] The bounce reason for YahooInc |
| 10 | # @see https://senders.yahooinc.com/smtp-error-codes |
| 11 | # https://smtpfieldmanual.com/provider/yahoo |
| 12 | # https://www.postmastery.com/yahoo-postmaster/ |
| 13 | # @since v5.1.0 |
| 14 | my $class = shiftscip-perl cpan Sisimai v5.7.0 Sisimai/Rhost/YahooInc/shift().; |
| 15 | my $argvs = shiftscip-perl cpan Sisimai v5.7.0 Sisimai/Rhost/YahooInc/shift(). // return ""; return "" unless $argvs->{'diagnosticcode'}; |
| 16 | |
| 17 | state $messagesof = { |
| 18 | 'authfailure' => [ |
| 19 | # - 550 5.7.9 This mail has been blocked because the sender is unauthenticated. Yahoo |
| 20 | # requires all senders to authenticate with either SPF or DKIM. |
| 21 | 'yahoo requires all senders to authenticate with either spf or dkim', |
| 22 | ], |
| 23 | 'blocked' => [ |
| 24 | # - 553 5.7.1 [BL21] Connections will not be accepted from 192.0.2.25, |
| 25 | # because the ip is in Spamhaus's list; see http://postmaster.yahoo.com/550-bl23.html |
| 26 | # - 553 5.7.1 [BL23] Connections not accepted from IP addresses on Spamhaus XBL; |
| 27 | # see http://postmaster.yahoo.com/errors/550-bl23.html [550]", |
| 28 | " because the ip is in spamhaus's list;", |
| 29 | 'not accepted from ip addresses on spamhaus xbl', |
| 30 | ], |
| 31 | 'norelaying' => [ |
| 32 | # - 550 relaying denied for <***@yahoo.com> |
| 33 | 'relaying denied for ', |
| 34 | ], |
| 35 | 'notcompliantrfc' => ['headers are not rfc compliant'], |
| 36 | 'policyviolation' => [ |
| 37 | # - 554 Message not allowed - [PH01] Email not accepted for policy reasons. |
| 38 | # Please visit https://postmaster.yahooinc.com/error-codes |
| 39 | # - 554 5.7.9 Message not accepted for policy reasons. |
| 40 | # See https://postmaster.yahooinc.com/error-codes |
| 41 | 'not accepted for policy reasons', |
| 42 | ], |
| 43 | 'ratelimited' => [ |
| 44 | # - 421 Max message per connection reached, closing transmission channel |
| 45 | 'max message per connection reached', |
| 46 | # - 450 User is receiving mail too quickly |
| 47 | 'user is receiving mail too quickly', |
| 48 | ], |
| 49 | 'rejected' => [ |
| 50 | # Observed the following error message since around March 2024: |
| 51 | # |
| 52 | # - 421 4.7.0 [TSS04] Messages from 192.0.2.25 temporarily deferred due to unexpected |
| 53 | # volume or user complaints - 4.16.55.1; |
| 54 | # see https://postmaster.yahooinc.com/error-codes (in reply to MAIL FROM command)) |
| 55 | # |
| 56 | # However, the same error message is returned even for domains that are considered to |
| 57 | # have a poor reputation without SPF, DKIM, or DMARC settings, or for other reasons. |
| 58 | # It seems that the error message is not as granular as Google's. |
| 59 | 'temporarily deferred due to unexpected volume or user complaints', |
| 60 | |
| 61 | # - 451 Message temporarily deferred due to unresolvable RFC.5321 from domain. |
| 62 | # See https://senders.yahooinc.com/error-codes#unresolvable-from-domain |
| 63 | 'due to unresolvable rfc.5321 domain', |
| 64 | |
| 65 | # - 553 5.7.2 [TSS09] All messages from 192.0.2.25 will be permanently deferred; |
| 66 | # Retrying will NOT succeed. See https://postmaster.yahooinc.com/error-codes |
| 67 | # - 553 5.7.2 [TSS11] All messages from 192.0.2.25 will be permanently deferred; |
| 68 | # Retrying will NOT succeed. See https://postmaster.yahooinc.com/error-codes |
| 69 | ' will be permanently deferred', |
| 70 | ], |
| 71 | 'suspend' => [ |
| 72 | # - 554 delivery error: dd ****@yahoo.com is no longer valid. |
| 73 | # - 554 30 Sorry, your message to *****@aol.jp cannot be delivered. |
| 74 | # This mailbox is disabled (554.30) |
| 75 | ' is no longer valid.', |
| 76 | 'this mailbox is disabled', |
| 77 | ], |
| 78 | 'syntaxerror' => [ |
| 79 | # - 501 Syntax error in parameters or arguments |
| 80 | 'syntax error in parameters or arguments', |
| 81 | ], |
| 82 | 'userunknown' => [ |
| 83 | # - 554 delivery error: dd This user doesn't have a yahoo.com account (***@yahoo.com) |
| 84 | # - 552 1 Requested mail action aborted, mailbox not found (in reply to end of DATA command) |
| 85 | "dd this user doesn't have a ", |
| 86 | 'mailbox not found', |
| 87 | ], |
| 88 | }; |
| 89 | |
| 90 | my $issuedcode = lcscip-perl cpan Sisimai v5.7.0 Sisimai/Rhost/YahooInc/lc(). $argvs->{'diagnosticcode'}; |
| 91 | my $reasontext = ''; |
| 92 | |
| 93 | for my $e ( keysscip-perl cpan Sisimai v5.7.0 Sisimai/Rhost/YahooInc/keys(). %$messagesof ) { |
| 94 | # Try to find the error message matches with the given error message string |
| 95 | next unless grepscip-perl cpan Sisimai v5.7.0 Sisimai/Rhost/YahooInc/grep(). { indexscip-perl cpan Sisimai v5.7.0 Sisimai/Rhost/YahooInc/index().($issuedcode, $_scip-perl cpan Sisimai v5.7.0 Sisimai/Rhost/YahooInc/$_.) > -1 } $messagesof->{ $e }->@*; |
| 96 | $reasontext = $e; |
| 97 | last; |
| 98 | } |
| 99 | return $reasontext; |
| 100 | } |
| 101 | |
| 102 | 1; |
| 103 | __END__ |
| 104 | |
| 105 | =encoding utf-8 |
| 106 | |
| 107 | =head1 NAME |
| 108 | |
| 109 | Sisimai::Rhost::YahooInc - Detect the bounce reason returned from Yahoo Inc. |
| 110 | |
| 111 | =head1 SYNOPSIS |
| 112 | |
| 113 | use Sisimai::Rhost::YahooInc; |
| 114 | |
| 115 | =head1 DESCRIPTION |
| 116 | |
| 117 | C<Sisimai::Rhost::YahooInc> detects the bounce reason from the content of C<Sisimai::Fact> object |
| 118 | as an argument of C<find()> method when the value of C<rhost> of the object end with C<*.yahoodns.net>. |
| 119 | This class is called only C<Sisimai::Fact> class. |
| 120 | |
| 121 | =head1 CLASS METHODS |
| 122 | |
| 123 | =head2 C<B<find(I<Sisimai::Fact Object>)>> |
| 124 | |
| 125 | C<find()> method detects the bounce reason. |
| 126 | |
| 127 | =head1 AUTHOR |
| 128 | |
| 129 | azumakuniyuki |
| 130 | |
| 131 | =head1 COPYRIGHT |
| 132 | |
| 133 | Copyright (C) 2024,2025 azumakuniyuki, All rights reserved. |
| 134 | |
| 135 | =head1 LICENSE |
| 136 | |
| 137 | This software is distributed under The BSD 2-Clause License. |
| 138 | |
| 139 | =cut |
| 140 |