Sisimai/Reason/UserUnknown.pm

filter: Statementstmt 95.8% 46 / 48 Branchbran 85.0% 17 / 20 Conditioncond 100% 6 / 6 MC/DCmcdc 100% 3 / 3 Subroutinesub 100% 9 / 9 Podpod 50.0% 2 / 4 totaltotal 92.2% 83 / 90 CC 15 SCAR 20.0
CC
15
Cov
93%
true
12.2
match
4.0
BEGIN
1.0
CRAP 7.4
« Sisimai/Rhost/Mimecast.pm ↑ Summary Sisimai/Rhost/Spectrum.pm »
1 package Sisimai::Reason::UserUnknown;
2 67 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 67 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 67 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 67 ▶use Sisimai::Eb;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 67 ▶use Sisimai::String;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 747 ▶sub text { $Sisimai::Eb::ReUSER }
Subroutine text: called CC=1 SCAR=0.0
Pod documented
9 4 ▶sub description { "Email rejected due to a local part of a recipient's email address does not exist" }
Subroutine description: called CC=1 SCAR=0.0
Pod undocumented
10 1419 ▶sub match {
Subroutine match: called CC=4 SCAR=13.9
Pod documented
11 # Try to match that the given text and regular expressions
12 # @param [String] argv1 String to be matched with regular expressions
13 # @return [Integer] 0: Did not match
14 # 1: Matched
15 # @since v4.0.0
16 1419 my $class = shift;
17 1419 ▶ my $argv1 = shift // return 0;
Condition100%2/2
shift() // (return 0)
l!l
14181
MC/DC100%1/1
shift() // (return 0)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
18  
19 1418 state $index = [
20 "#5.1.1 bad address",
21 "550 address invalid",
22 "5.1.0 address rejected.",
23 "address not present in directory",
24 "address unknown",
25 "badrcptto",
26 "can't accept user",
27 "destination addresses were unknown",
28 "destination server rejected recipients",
29 "domain or user isn't in my list of allowed rcpthosts",
30 "email account that you tried to reach does not exist",
31 "email address could not be found",
32 "invalid address",
33 "invalid mailbox",
34 "is not a known user",
35 "is not a valid mailbox",
36 "mailbox does not exist",
37 "mailbox invalid",
38 "mailbox not present",
39 "mailbox not found",
40 "nessun utente simile in questo indirizzo",
41 "no account by that name here",
42 "no existe dicha persona",
43 "no existe ese usuario ",
44 "no such recipient",
45 "no such user",
46 "no thank you rejected: account unavailable",
47 "no valid recipients, bye",
48 "not a valid recipient",
49 "not a valid user here",
50 "not a local address",
51 "not email addresses",
52 "recipient address rejected. (in reply to rcpt to command)",
53 "recipient address rejected: access denied",
54 "recipient address rejected: userunknown",
55 "recipient is in my badrecipientto list",
56 "recipient is not accepted",
57 "recipient is not in my validrcptto list",
58 "recipient is not local",
59 "recipient mailbox unallocated", # comcast.net
60 "recipient not ok",
61 "recipient refuses to accept your mail",
62 "recipient unknown",
63 "recipients was undeliverable",
64 "spectator does not exist",
65 "there is no one at this address",
66 "unknown mailbox",
67 "unknown recipient",
68 "unknown user",
69 "user missing home directory",
70 "user not known",
71 "user unknown",
72 "utilisateur inconnu !",
73 "weil die adresse nicht gefunden wurde oder keine e-mails empfangen kann",
74 "your envelope recipient has been denied",
75 ];
76 1418 state $pairs = [
77 ["<", "> not found"],
78 ["<", ">... blocked by "],
79 ["account ", " does not exist at the organization"],
80 ["address", " no longer"],
81 ["address", " not exist"],
82 ["bad", "recipient"],
83 ["invalid", "recipient"],
84 ["invalid", "user"],
85 ["mailbox ", "does not exist"],
86 ["mailbox ", "unavailable"],
87 ["no ", " in name directory"],
88 ["no ", "mail", "box "],
89 ["no ", "such", "address"],
90 ["non", "existent user"],
91 ["rcpt <", " does not exist"],
92 ["rcpt (", "t exist "],
93 ["recipient no", "found"],
94 ["recipient ", " not exist"],
95 ["recipient ", " was not found in"],
96 ["this user doesn't have a ", " account"],
97 ["unknown e", "mail address"],
98 ["unknown local", "part"],
99 ["user ", " not exist"],
100 ["user ", "doesn't exist"],
101 ["user ", "not found"],
102 ["user (", ") unknown"],
103 ["user <", "> unknown"],
104 ];
105  
106 1418 ▶ return 1 if grep { rindex($argv1, $_) > -1 } @$index;
Branch: 1 branch
BranchTrueFalseTotal
if grep {rindex($argv1, $_) != -1;} @$index 333 1085 1418
107 1085 ▶ return 1 if grep { Sisimai::String->aligned(\$argv1, $_) } @$pairs;
Branch: 1 branch
BranchTrueFalseTotal
if grep {"Sisimai::String"->aligned(\$argv1, $_);} @$pairs 47 1038 1085
108 1038 return 0;
109 }
110  
111 2037 ▶sub true {
Subroutine true: called CC=12 SCAR=25.0
Pod undocumented
112 # Whether the address is "UserUnknown" or not
113 # @param [Sisimai::Fact] argvs Object to be detected the reason
114 # @return [Integer] 1: is unknown user
115 # 0: is not unknown user.
116 # @since v4.0.0
117 # @see http://www.ietf.org/rfc/rfc2822.txt
118 2037 my $class = shift;
119 2037 ▶ my $argvs = shift // return 0;
Condition100%2/2
shift() // (return 0)
l!l
20361
MC/DC100%1/1
shift() // (return 0)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
120  
121 2036 require Sisimai::SMTP::Command;
122 2036 ▶ return 1 if $argvs->{'reason'} eq $Sisimai::Eb::ReUSER;
Branch: 1 branch
BranchTrueFalseTotal
if $argvs->{"reason"} eq $Sisimai::Eb::ReUSER 116 1920 2036
123 1920 ▶ return 0 if grep { $argvs->{'command'} eq $_ } Sisimai::SMTP::Command->BeforeRCPT->@*;
Branch: 1 branch
BranchTrueFalseTotal
if grep {$argvs->{"command"} eq $_;} @{"Sisimai::SMTP::Command"->BeforeRCPT} 222 1698 1920
124  
125 1698 ▶ my $tempreason = Sisimai::SMTP::Status->name($argvs->{'deliverystatus'}) || '';
Condition100%2/2
'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'}) || ''
l!l
1016682
MC/DC100%1/1
'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'}) || ''
'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'})
Truth table100%2/2
A
A= 'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'})
Aresult
11
00
126 1698 ▶ return 0 if $tempreason eq $Sisimai::Eb::ReQUIT;
Branch: 1 branch
BranchTrueFalseTotal
if $tempreason eq $Sisimai::Eb::ReQUIT 0 1698 1698
127  
128 1698 my $issuedcode = lc $argvs->{'diagnosticcode'};
129 1698 ▶ if( $tempreason eq $Sisimai::Eb::ReUSER ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($tempreason eq $Sisimai::Eb::ReUSER) { } 456 1242 1698
elsif ($argvs->{'command'} eq $Sisimai::Eb::CeRCPT) { } 213 1029 1242
130 # *.1.1 = 'Bad destination mailbox address'
131 # Status: 5.1.1
132 # Diagnostic-Code: SMTP; 550 5.1.1 <***@example.jp>:
133 # Recipient address rejected: User unknown in local recipient table
134 456 state $prematches = [
135 $Sisimai::Eb::RePASS, $Sisimai::Eb::ReBLOC, $Sisimai::Eb::ReFULL,
136 $Sisimai::Eb::ReMOVE, $Sisimai::Eb::ReFROM, $Sisimai::Eb::Re00MX,
137 ];
138 456 state $ModulePath = {
139 'Sisimai::Reason::NoRelaying' => 'Sisimai/Reason/NoRelaying.pm',
140 'Sisimai::Reason::Blocked' => 'Sisimai/Reason/Blocked.pm',
141 'Sisimai::Reason::MailboxFull' => 'Sisimai/Reason/MailboxFull.pm',
142 'Sisimai::Reason::HasMoved' => 'Sisimai/Reason/HasMoved.pm',
143 'Sisimai::Reason::Rejected' => 'Sisimai/Reason/Rejected.pm',
144 'Sisimai::Reason::NotAccept' => 'Sisimai/Reason/NotAccept.pm',
145 };
146 456 my $matchother = 0;
147  
148 456 for my $e ( @$prematches ) {
149 # Check the value of "Diagnostic-Code" with other error patterns.
150 2736 my $p = 'Sisimai::Reason::'.$e;
151 2736 require $ModulePath->{ $p };
152  
153 2736 ▶ next unless $p->match($issuedcode);
Branch: 1 branch
BranchTrueFalseTotal
unless $p->match($issuedcode) 2736 0 2736
154 # Match with reason defined in Sisimai::Reason::* except UserUnknown.
155 0 $matchother = 1;
156 0 last;
157 }
158 456 ▶ return 1 unless $matchother; # Did not match with other message patterns
Branch: 1 branch
BranchTrueFalseTotal
unless $matchother 456 0 456
159  
160 } elsif( $argvs->{'command'} eq $Sisimai::Eb::CeRCPT ) {
161 # When the SMTP command is not "RCPT", the session rejected by other reason, maybe.
162 213 ▶ return 1 if __PACKAGE__->match($issuedcode);
Branch: 1 branch
BranchTrueFalseTotal
if __PACKAGE__->match($issuedcode) 108 105 213
163 }
164 1134 return 0;
165 }
166  
167 67 1;
168 __END__
« Sisimai/Rhost/Mimecast.pm ↑ Summary Sisimai/Rhost/Spectrum.pm »