Sisimai/Rhost/Apple.pm

filter: Statementstmt 100% 22 / 22 Branchbran 100% 4 / 4 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 97.0% 33 / 34 CC 5 SCAR 12.5
CC
5
Cov
100%
find
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.5
« Sisimai/Rhost/Aol.pm ↑ Summary Sisimai/Rhost/MessageLabs.pm »
1 package Sisimai::Rhost::Apple;
2 9 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 64 ▶sub find {
Subroutine find: called CC=5 SCAR=16.1
Pod undocumented
7 # Detect bounce reason from Apple iCloud Mail
8 # @param [Sisimai::Fact] argvs Decoded email object
9 # @return [String] The bounce reason for Apple
10 # @see
11 # @since v5.1.0
12 # - Postmaster information for iCloud Mail: https://support.apple.com/en-us/102322
13 # - https://www.postmastery.com/icloud-postmastery-page/
14 # - https://smtpfieldmanual.com/provider/apple
15 64 my $class = shift;
16 64 ▶ my $argvs = shift // return ""; return '' unless length $argvs->{'diagnosticcode'};
Branch: 1 branch
BranchTrueFalseTotal
unless length $argvs->{"diagnosticcode"} 1 62 63
Condition100%2/2
shift() // (return "")
l!l
631
MC/DC100%1/1
shift() // (return "")
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
17  
18 62 require Sisimai::Eb;
19 62 state $messagesof = {
20 $Sisimai::Eb::ReAUTH => [
21 # - 554 5.7.1 Your message was rejected due to example.jp's DMARC policy.
22 # See https://support.apple.com/en-us/HT204137 for
23 # - 554 5.7.1 [HME1] This message was blocked for failing both SPF and DKIM authentication
24 # checks. See https://support.apple.com/en-us/HT204137 for mailing best practices
25 's dmarc policy',
26 'blocked for failing both spf and dkim autentication checks',
27 ],
28 $Sisimai::Eb::ReBLOC => [
29 # - 550 5.7.0 Blocked - see https://support.proofpoint.com/dnsbl-lookup.cgi?ip=192.0.1.2
30 # - 550 5.7.1 Your email was rejected due to having a domain present in the Spamhaus
31 # DBL -- see https://www.spamhaus.org/dbl/
32 # - 550 5.7.1 Mail from IP 192.0.2.1 was rejected due to listing in Spamhaus SBL.
33 # For details please see http://www.spamhaus.org/query/bl?ip=x.x.x.x
34 # - 554 ****-smtpin001.me.com ESMTP not accepting connections
35 'rejected due to having a domain present in the spamhaus',
36 'rejected due to listing in spamhaus',
37 'blocked - see https://support.proofpoint.com/dnsbl-lookup',
38 'not accepting connections',
39 ],
40 $Sisimai::Eb::ReMOVE => [
41 # - 550 5.1.6 recipient no longer on server: *****@icloud.com
42 'recipient no longer on server',
43 ],
44 $Sisimai::Eb::ReFULL => [
45 # - 552 5.2.2 <****@icloud.com>: user is over quota (in reply to RCPT TO command)
46 'user is over quota',
47 ],
48 $Sisimai::Eb::RePASS => [
49 # - 554 5.7.1 <*****@icloud.com>: Relay access denied
50 'relay access denied',
51 ],
52 $Sisimai::Eb::Re00MX => ['host/domain does not accept mail'],
53 $Sisimai::Eb::ReWONT => [
54 # - 550 5.7.1 [CS01] Message rejected due to local policy.
55 # Please visit https://support.apple.com/en-us/HT204137
56 'due to local policy',
57 ],
58 $Sisimai::Eb::ReRATE => [
59 # - 421 4.7.1 Messages to ****@icloud.com deferred due to excessive volume.
60 # Try again later - https://support.apple.com/en-us/HT204137
61 'due to excessive volume',
62 ],
63 $Sisimai::Eb::ReFROM => [
64 # - 450 4.1.8 <kijitora@example.jp>: Sender address rejected: Domain not found
65 'sender address rejected',
66 ],
67 $Sisimai::Eb::ReQUIT => [
68 # - https://support.apple.com/guide/icloud/stop-using-or-reactivate-addresses-mm3adb030cbf/icloud
69 # - 550 5.1.1 <****@icloud.com>: inactive email address (in reply to RCPT TO command)
70 "inactive email address",
71 ],
72 $Sisimai::Eb::ReUSER => [
73 # - 550 5.1.1 <****@icloud.com>: inactive email address (in reply to RCPT TO command)
74 # - 550 5.1.1 unknown or illegal alias: ****@icloud.com
75 'user does not exist',
76 'unknown or illegal alias',
77 ],
78 };
79 62 my $issuedcode = lc $argvs->{'diagnosticcode'};
80 62 my $reasontext = '';
81  
82 62 for my $e ( keys %$messagesof ) {
83 # Try to find the error message matches with the given error message string
84 433 ▶ next unless grep { index($issuedcode, $_) > -1 } $messagesof->{ $e }->@*;
Branch: 1 branch
BranchTrueFalseTotal
unless grep {index($issuedcode, $_) != -1;} @{$$messagesof{$e}} 379 54 433
85 54 $reasontext = $e;
86 54 last;
87 }
88 62 return $reasontext;
89 }
90  
91 9 1;
92 __END__
« Sisimai/Rhost/Aol.pm ↑ Summary Sisimai/Rhost/MessageLabs.pm »