Sisimai/Reason/Rejected.pm

filter: Statementstmt 100% 39 / 39 Branchbran 100% 24 / 24 Conditioncond 88.8% 16 / 18 MC/DCmcdc 66.6% 6 / 9 Subroutinesub 100% 8 / 8 Podpod 50.0% 2 / 4 totaltotal 93.1% 95 / 102 CC 20 SCAR 23.6
CC
20
Cov
98%
true
16.0
match
5.0
BEGIN
1.0
CRAP 10.6
« Sisimai/Rhost/Microsoft.pm ↑ Summary Sisimai/Mail/Maildir.pm »
1 package Sisimai::Reason::Rejected;
2 59 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 59 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 59 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 59 ▶use Sisimai::Eb;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 113 ▶sub text { $Sisimai::Eb::ReFROM }
Subroutine text: called CC=1 SCAR=0.0
Pod documented
8 4 ▶sub description { "Email rejected due to a sender's email address (envelope from)" }
Subroutine description: called CC=1 SCAR=0.0
Pod undocumented
9 1302 ▶sub match {
Subroutine match: called CC=5 SCAR=16.1
Pod documented
10 # Try to match that the given text and regular expressions
11 # @param [String] argv1 String to be matched with regular expressions
12 # @return [Integer] 0: Did not match
13 # 1: Matched
14 # @since v4.0.0
15 1302 my $class = shift;
16 1302 ▶ my $argv1 = shift // return 0;
Condition100%2/2
shift() // (return 0)
l!l
13011
MC/DC100%1/1
shift() // (return 0)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
17  
18 1301 state $isnot = [
19 "5.1.0 address rejected",
20 "ip address ",
21 "recipient address rejected",
22 ];
23 1301 state $index = [
24 "access denied (in reply to mail from command)",
25 "administrative prohibition",
26 "all recipient addresses rejected : access denied",
27 "badsendermx", # BadSenderMX
28 "backscatter protection detected an invalid or expired email address", # MDaemon
29 "by non-member to a members-only list",
30 "can't determine purported responsible address",
31 "connections not accepted from servers without a valid sender domain",
32 "denied by secumail valid-address-filter", # SecuMail
33 "domain of sender address ",
34 "email address is on senderfilterconfig list",
35 "emetteur invalide",
36 "empty email address",
37 "empty envelope senders not allowed",
38 "from: domain is invalid. please provide a valid from:",
39 "fully qualified email address required", # McAfee
40 "has an outgoing mail suspension",
41 "invalid sender",
42 "is not a registered gateway user",
43 "mail from not owned by user",
44 "mailfrom domain is listed in spamhaus",
45 "not member article from ", # FML
46 "null sender is not allowed",
47 "returned mail not accepted here",
48 "sending this from a different address or alias using the ",
49 "sender is spammer",
50 "sender not pre-approved",
51 "sender domain is empty",
52 "sender domain listed at ",
53 "sender verify failed", # Exim callout
54 "sendernoa", # SenderNoA
55 "server does not accept mail from",
56 "spam reporting address", # SendGrid|a message to an address has previously been marked as Spam by the recipient.
57 "too many spam complaints",
58 "unroutable sender address",
59 "you are not allowed to post to this mailing list",
60 "your access to submit messages to this e-mail system has been rejected",
61 "your email address has been blacklisted", # MessageLabs
62 ];
63 1301 state $pairs = [
64 ["after end of data:", ".", " does not exist"],
65 ["after mail from:", ".", " does not exist"],
66 ["domain ", " is a dead domain"],
67 ["email address ", "is not "],
68 ["reject mail from ", "@"], # FML
69 ["send", "blacklisted"],
70 ["sender", " rejected"],
71 ["sender is", " list"],
72 ];
73  
74 1301 ▶ return 0 if grep { rindex($argv1, $_) > -1 } @$isnot;
Branch: 1 branch
BranchTrueFalseTotal
if grep {rindex($argv1, $_) != -1;} @$isnot 161 1140 1301
75 1140 ▶ return 1 if grep { rindex($argv1, $_) > -1 } @$index;
Branch: 1 branch
BranchTrueFalseTotal
if grep {rindex($argv1, $_) != -1;} @$index 40 1100 1140
76 1100 ▶ return 1 if grep { Sisimai::String->aligned(\$argv1, $_) } @$pairs;
Branch: 1 branch
BranchTrueFalseTotal
if grep {"Sisimai::String"->aligned(\$argv1, $_);} @$pairs 20 1080 1100
77 1080 return 0;
78 }
79  
80 1007 ▶sub true {
Subroutine true: called CC=16 SCAR=27.7
Pod undocumented
81 # Rejected by the envelope sender address or not
82 # @param [Sisimai::Fact] argvs Object to be detected the reason
83 # @return [Integer] 1: is Rejected
84 # 0: is not Rejected by the sender
85 # @since v4.0.0
86 # @see http://www.ietf.org/rfc/rfc2822.txt
87 1007 my $class = shift;
88 1007 ▶ my $argvs = shift // return 0;
Condition100%2/2
shift() // (return 0)
l!l
10061
MC/DC100%1/1
shift() // (return 0)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
89  
90 1006 ▶ return 1 if $argvs->{'reason'} eq $Sisimai::Eb::ReFROM;
Branch: 1 branch
BranchTrueFalseTotal
if $argvs->{"reason"} eq $Sisimai::Eb::ReFROM 1 1005 1006
91 1005 ▶ my $tempreason = Sisimai::SMTP::Status->name($argvs->{'deliverystatus'}) || $Sisimai::Eb::Re___0;
Condition66%2/3
'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'}) || $Sisimai::Eb::Re___0
l!l&&r!l&&!r
4665390
MC/DC0%0/2
'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'}) || $Sisimai::Eb::Re___0
'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'}) $Sisimai::Eb::Re___0
Truth table66%2/3
A || B
A= 'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'})B= $Sisimai::Eb::Re___0
ABresult
1X1
011
000
92 1005 ▶ return 1 if $tempreason eq $Sisimai::Eb::ReFROM; # Delivery status code points "Rejected".
Branch: 1 branch
BranchTrueFalseTotal
if $tempreason eq $Sisimai::Eb::ReFROM 56 949 1005
93  
94 # Check the value of Diagnosic-Code: header with patterns
95 949 my $issuedcode = lc $argvs->{'diagnosticcode'};
96 949 ▶ my $thecommand = $argvs->{'command'} || '';
Condition100%2/2
$argvs->{'command'} || ''
l!l
331618
MC/DC100%1/1
$argvs->{'command'} || ''
$argvs->{'command'}
Truth table100%2/2
A
A= $argvs->{'command'}
Aresult
11
00
97 949 ▶ if( $thecommand eq $Sisimai::Eb::CeMAIL ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($thecommand eq $Sisimai::Eb::CeMAIL) { } 87 862 949
elsif ($thecommand eq $Sisimai::Eb::CeDATA) { } 98 764 862
elsif ($tempreason eq $Sisimai::Eb::Re___1 or $tempreason eq $Sisimai::Eb::Re___0 or $tempreason eq $Sisimai::Eb::ReSAFE or $tempreason eq $Sisimai::Eb::RePROC) { } 559 205 764
98 # The session was rejected at 'MAIL FROM' command
99 87 ▶ return 1 if __PACKAGE__->match($issuedcode);
Branch: 1 branch
BranchTrueFalseTotal
if __PACKAGE__->match($issuedcode) 26 61 87
100  
101 } elsif( $thecommand eq $Sisimai::Eb::CeDATA ) {
102 # The session was rejected at 'DATA' command
103 98 ▶ if( $tempreason ne $Sisimai::Eb::ReUSER ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tempreason ne $Sisimai::Eb::ReUSER) 97 1 98
104 # Except "userunknown"
105 97 ▶ return 1 if __PACKAGE__->match($issuedcode);
Branch: 1 branch
BranchTrueFalseTotal
if __PACKAGE__->match($issuedcode) 16 81 97
106 }
107 ▶ } elsif( $tempreason eq $Sisimai::Eb::Re___1 || $tempreason eq $Sisimai::Eb::Re___0 ||
Condition88%8/9
$tempreason eq $Sisimai::Eb::Re___1 or $tempreason eq $Sisimai::Eb::Re___0 or $tempreason eq $Sisimai::Eb::ReSAFE or $tempreason eq $Sisimai::Eb::RePROC
l!l&&r!l&&!r
53425205
$tempreason eq $Sisimai::Eb::Re___1 or $tempreason eq $Sisimai::Eb::Re___0 or $tempreason eq $Sisimai::Eb::ReSAFE
l!l&&r!l&&!r
44292230
$tempreason eq $Sisimai::Eb::Re___1 or $tempreason eq $Sisimai::Eb::Re___0
l!l&&r!l&&!r
0442322
MC/DC75%3/4
$tempreason eq $Sisimai::Eb::Re___1 or $tempreason eq $Sisimai::Eb::Re___0 or $tempreason eq $Sisimai::Eb::ReSAFE or $tempreason eq $Sisimai::Eb::RePROC
$tempreason eq $Sisimai::Eb::Re___1 $tempreason eq $Sisimai::Eb::Re___0 $tempreason eq $Sisimai::Eb::ReSAFE $tempreason eq $Sisimai::Eb::RePROC
Truth table80%4/5
A or B or C or D
A= $tempreason eq $Sisimai::Eb::Re___1B= $tempreason eq $Sisimai::Eb::Re___0C= $tempreason eq $Sisimai::Eb::ReSAFED= $tempreason eq $Sisimai::Eb::RePROC
ABCDresult
1XXX1
01XX1
001X1
00011
00000
108 $tempreason eq $Sisimai::Eb::ReSAFE || $tempreason eq $Sisimai::Eb::RePROC ) {
109 # Try to match with message patterns when the temporary reason is "OnHold", "Undefined",
110 # "SecurityError", or "SystemError"
111 559 ▶ return 1 if __PACKAGE__->match($issuedcode);
Branch: 1 branch
BranchTrueFalseTotal
if __PACKAGE__->match($issuedcode) 15 544 559
112 }
113 892 return 0;
114 }
115  
116 59 1;
117 __END__
« Sisimai/Rhost/Microsoft.pm ↑ Summary Sisimai/Mail/Maildir.pm »