| 1 | package Sisimai::SMTP::Reply; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 91 | ▶ | use v5.26; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 91 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 91 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 91 | ▶ | use Sisimai::Eb; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | # http://www.ietf.org/rfc/rfc5321.txt | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # RFC 1870: SMTP Service Extension for Message Size Declaration (SIZE) | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # RFC 1985: SMTP Service Extension for Remote Message Queue Starting (ETRN) | ||||||||||||||||||||||||||||||||||||||||||
| 10 | # RFC 2645: Authenticated TURN for On-Demand Mail Relay (ATRN) | ||||||||||||||||||||||||||||||||||||||||||
| 11 | # RFC 3207: SMTP Service Extension for Secure SMTP over Transport Layer Security (STARTTLS) 1 | ||||||||||||||||||||||||||||||||||||||||||
| 12 | # RFC 3030: SMTP Service Extension for Command Pipelining (CHUNKING) | ||||||||||||||||||||||||||||||||||||||||||
| 13 | # RFC 3461: Delivery Status Notifications (DSN) | ||||||||||||||||||||||||||||||||||||||||||
| 14 | # RFC 4954: SMTP Service Extension for Authentication (AUTH) | ||||||||||||||||||||||||||||||||||||||||||
| 15 | # RFC 5321: Simple Mail Transfer Protocol | ||||||||||||||||||||||||||||||||||||||||||
| 16 | # RFC 5336: SMTP Extension for Internationalized Email (UTF8SMTP) | ||||||||||||||||||||||||||||||||||||||||||
| 17 | # RFC 6531: SMTP Extension for Internationalized Email (SMTPUTF8) | ||||||||||||||||||||||||||||||||||||||||||
| 18 | # RFC 7504: SMTP 521 and 556 Reply Codes | ||||||||||||||||||||||||||||||||||||||||||
| 19 | # RFC 9422: The LIMITS SMTP Service Extension | ||||||||||||||||||||||||||||||||||||||||||
| 20 | # ------------------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 21 | # 4.2.1. Reply Code Severities and Theory | ||||||||||||||||||||||||||||||||||||||||||
| 22 | # | ||||||||||||||||||||||||||||||||||||||||||
| 23 | # There are four values for the first digit of the reply code: | ||||||||||||||||||||||||||||||||||||||||||
| 24 | # | ||||||||||||||||||||||||||||||||||||||||||
| 25 | # 2yz Positive Completion reply | ||||||||||||||||||||||||||||||||||||||||||
| 26 | # The requested action has been successfully completed. A new request may be initiated. | ||||||||||||||||||||||||||||||||||||||||||
| 27 | # | ||||||||||||||||||||||||||||||||||||||||||
| 28 | # 3yz Positive Intermediate reply | ||||||||||||||||||||||||||||||||||||||||||
| 29 | # The command has been accepted, but the requested action is being held in abeyance, pending | ||||||||||||||||||||||||||||||||||||||||||
| 30 | # receipt of further information. The SMTP client should send another command specifying this | ||||||||||||||||||||||||||||||||||||||||||
| 31 | # information. This reply is used in command sequence groups (i.e., in DATA). | ||||||||||||||||||||||||||||||||||||||||||
| 32 | # | ||||||||||||||||||||||||||||||||||||||||||
| 33 | # 4yz Transient Negative Completion reply | ||||||||||||||||||||||||||||||||||||||||||
| 34 | # The command was not accepted, and the requested action did not occur. However, the error | ||||||||||||||||||||||||||||||||||||||||||
| 35 | # condition is temporary, and the action may be requested again. The sender should return to | ||||||||||||||||||||||||||||||||||||||||||
| 36 | # the beginning of the command sequence (if any). It is difficult to assign a meaning to | ||||||||||||||||||||||||||||||||||||||||||
| 37 | # "transient" when two different sites (receiver- and sender-SMTP agents) must agree on the | ||||||||||||||||||||||||||||||||||||||||||
| 38 | # interpretation. Each reply in this category might have a different time value, but the SMTP | ||||||||||||||||||||||||||||||||||||||||||
| 39 | # client SHOULD try again. A rule of thumb to determine whether a reply fits into the 4yz or | ||||||||||||||||||||||||||||||||||||||||||
| 40 | # the 5yz category (see below) is that replies are 4yz if they can be successful if repeated | ||||||||||||||||||||||||||||||||||||||||||
| 41 | # without any change in command form or in properties of the sender or receiver (that is, the | ||||||||||||||||||||||||||||||||||||||||||
| 42 | # command is repeated identically and the receiver does not put up a new implementation). | ||||||||||||||||||||||||||||||||||||||||||
| 43 | # | ||||||||||||||||||||||||||||||||||||||||||
| 44 | # 5yz Permanent Negative Completion reply | ||||||||||||||||||||||||||||||||||||||||||
| 45 | # The command was not accepted and the requested action did not occur. The SMTP client SHOULD | ||||||||||||||||||||||||||||||||||||||||||
| 46 | # NOT repeat the exact request (in the same sequence). Even some "permanent" error conditions | ||||||||||||||||||||||||||||||||||||||||||
| 47 | # can be corrected, so the human user may want to direct the SMTP client to reinitiate the | ||||||||||||||||||||||||||||||||||||||||||
| 48 | # command sequence by direct action at some point in the future (e.g., after the spelling has | ||||||||||||||||||||||||||||||||||||||||||
| 49 | # been changed, or the user has altered the account status). | ||||||||||||||||||||||||||||||||||||||||||
| 50 | # | ||||||||||||||||||||||||||||||||||||||||||
| 51 | # The second digit encodes responses in specific categories: | ||||||||||||||||||||||||||||||||||||||||||
| 52 | # | ||||||||||||||||||||||||||||||||||||||||||
| 53 | # x0z Syntax: These replies refer to syntax errors, syntactically correct commands that do | ||||||||||||||||||||||||||||||||||||||||||
| 54 | # not fit any functional category, and unimplemented or superfluous commands. | ||||||||||||||||||||||||||||||||||||||||||
| 55 | # x1z Information: These are replies to requests for information, such as status or help. | ||||||||||||||||||||||||||||||||||||||||||
| 56 | # x2z Connections: These are replies referring to the transmission channel. | ||||||||||||||||||||||||||||||||||||||||||
| 57 | # x3z Unspecified. | ||||||||||||||||||||||||||||||||||||||||||
| 58 | # x4z Unspecified. | ||||||||||||||||||||||||||||||||||||||||||
| 59 | # x5z Mail system: These replies indicate the status of the receiver mail system vis-a-vis | ||||||||||||||||||||||||||||||||||||||||||
| 60 | # the requested transfer or other mail system action. | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 91 | state $ReplyCode2 = [ | |||||||||||||||||||||||||||||||||||||||||
| 63 | # http://www.ietf.org/rfc/rfc5321.txt | ||||||||||||||||||||||||||||||||||||||||||
| 64 | # 211 System status, or system help reply | ||||||||||||||||||||||||||||||||||||||||||
| 65 | # 214 Help message (Information on how to use the receiver or the meaning of a particular | ||||||||||||||||||||||||||||||||||||||||||
| 66 | # non-standard command; this reply is useful only to the human user) | ||||||||||||||||||||||||||||||||||||||||||
| 67 | # 220 <domain> Service ready | ||||||||||||||||||||||||||||||||||||||||||
| 68 | # 221 <domain> Service closing transmission channel | ||||||||||||||||||||||||||||||||||||||||||
| 69 | # 235 Authentication successful (See RFC2554) | ||||||||||||||||||||||||||||||||||||||||||
| 70 | # 250 Requested mail action okay, completed | ||||||||||||||||||||||||||||||||||||||||||
| 71 | # 251 User not local; will forward to <forward-path> (See Section 3.4) | ||||||||||||||||||||||||||||||||||||||||||
| 72 | # 252 Cannot VRFY user, but will accept message and attempt delivery (See Section 3.5.3) | ||||||||||||||||||||||||||||||||||||||||||
| 73 | # 253 OK, <n> pending messages for node <domain> started (See RFC1985) | ||||||||||||||||||||||||||||||||||||||||||
| 74 | # 334 A server challenge is sent as a 334 reply with the text part containing the [BASE64] | ||||||||||||||||||||||||||||||||||||||||||
| 75 | # encoded string supplied by the SASL mechanism. This challenge MUST NOT contain any text | ||||||||||||||||||||||||||||||||||||||||||
| 76 | # other than the BASE64 encoded challenge. (RFC4954) | ||||||||||||||||||||||||||||||||||||||||||
| 77 | # 354 Start mail input; end with <CRLF>.<CRLF> | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 211, 214, 220, 221, 235, 250, 251, 252, 253, 334, 354 | ||||||||||||||||||||||||||||||||||||||||||
| 79 | ]; | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 91 | state $ReplyCode4 = [ | |||||||||||||||||||||||||||||||||||||||||
| 81 | # 421 <domain> Service not available, closing transmission channel (This may be a reply to | ||||||||||||||||||||||||||||||||||||||||||
| 82 | # any command if the service knows it must shut down) | ||||||||||||||||||||||||||||||||||||||||||
| 83 | # 422 (See RFC5248) | ||||||||||||||||||||||||||||||||||||||||||
| 84 | # 430 (See RFC5248) | ||||||||||||||||||||||||||||||||||||||||||
| 85 | # 432 A password transition is needed (See RFC4954) | ||||||||||||||||||||||||||||||||||||||||||
| 86 | # 450 Requested mail action not taken: mailbox unavailable (e.g., mailbox busy or temporarily | ||||||||||||||||||||||||||||||||||||||||||
| 87 | # blocked for policy reasons) | ||||||||||||||||||||||||||||||||||||||||||
| 88 | # 451 Requested action aborted: local error in processing | ||||||||||||||||||||||||||||||||||||||||||
| 89 | # 452 Requested action not taken: insufficient system storage | ||||||||||||||||||||||||||||||||||||||||||
| 90 | # 453 You have no mail (See RFC2645) | ||||||||||||||||||||||||||||||||||||||||||
| 91 | # 454 Temporary authentication failure (See RFC4954) | ||||||||||||||||||||||||||||||||||||||||||
| 92 | # 455 Server unable to accommodate parameters | ||||||||||||||||||||||||||||||||||||||||||
| 93 | # 458 Unable to queue messages for node <domain> (See RFC1985) | ||||||||||||||||||||||||||||||||||||||||||
| 94 | # 459 Node <domain> not allowed: <reason> (See RFC51985) | ||||||||||||||||||||||||||||||||||||||||||
| 95 | 421, 450, 451, 452, 422, 430, 432, 453, 454, 455, 458, 459 | ||||||||||||||||||||||||||||||||||||||||||
| 96 | ]; | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 91 | state $ReplyCode5 = [ | |||||||||||||||||||||||||||||||||||||||||
| 98 | # 500 Syntax error, command unrecognized (This may include errors such as command line too long) | ||||||||||||||||||||||||||||||||||||||||||
| 99 | # 501 Syntax error in parameters or arguments | ||||||||||||||||||||||||||||||||||||||||||
| 100 | # 502 Command not implemented (see Section 4.2.4) | ||||||||||||||||||||||||||||||||||||||||||
| 101 | # 503 Bad sequence of commands | ||||||||||||||||||||||||||||||||||||||||||
| 102 | # 504 Command parameter not implemented | ||||||||||||||||||||||||||||||||||||||||||
| 103 | # 521 Host does not accept mail (See RFC7504) | ||||||||||||||||||||||||||||||||||||||||||
| 104 | # 523 Encryption Needed (See RFC5248) | ||||||||||||||||||||||||||||||||||||||||||
| 105 | # 524 (See RFC5248) | ||||||||||||||||||||||||||||||||||||||||||
| 106 | # 525 User Account Disabled (See RFC5248) | ||||||||||||||||||||||||||||||||||||||||||
| 107 | # 530 Authentication required (See RFC4954) | ||||||||||||||||||||||||||||||||||||||||||
| 108 | # 533 (See RFC5248) | ||||||||||||||||||||||||||||||||||||||||||
| 109 | # 534 Authentication mechanism is too weak (See RFC4954) | ||||||||||||||||||||||||||||||||||||||||||
| 110 | # 535 Authentication credentials invalid (See RFC4954) | ||||||||||||||||||||||||||||||||||||||||||
| 111 | # 538 Encryption required for requested authentication mechanism (See RFC4954) | ||||||||||||||||||||||||||||||||||||||||||
| 112 | # 550 Requested action not taken: mailbox unavailable (e.g., mailbox not found, no access, or | ||||||||||||||||||||||||||||||||||||||||||
| 113 | # command rejected for policy reasons) | ||||||||||||||||||||||||||||||||||||||||||
| 114 | # 551 User not local; please try <forward-path> (See Section 3.4) | ||||||||||||||||||||||||||||||||||||||||||
| 115 | # 552 Requested mail action aborted: exceeded storage allocation | ||||||||||||||||||||||||||||||||||||||||||
| 116 | # 553 Requested action not taken: mailbox name not allowed (e.g., mailbox syntax incorrect) | ||||||||||||||||||||||||||||||||||||||||||
| 117 | # 554 Transaction failed (Or, in the case of a connection-opening response, "No SMTP service here") | ||||||||||||||||||||||||||||||||||||||||||
| 118 | # 555 MAIL FROM/RCPT TO parameters not recognized or not implemented | ||||||||||||||||||||||||||||||||||||||||||
| 119 | # 556 Domain does not accept mail (See RFC7504) | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 550, 552, 553, 551, 521, 525, 523, 524, 530, 533, 534, 535, 538, 555, 556, 554, | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 500, 501, 502, 503, 504, | ||||||||||||||||||||||||||||||||||||||||||
| 122 | ]; | ||||||||||||||||||||||||||||||||||||||||||
| 123 | 91 | state $CodeOfSMTP = {'2' => $ReplyCode2, '4' => $ReplyCode4, '5' => $ReplyCode5}; | |||||||||||||||||||||||||||||||||||||||||
| 124 | 91 | state $Associated = { | |||||||||||||||||||||||||||||||||||||||||
| 125 | "422" => [$Sisimai::Eb::CeAUTH, "4.7.12", $Sisimai::Eb::ReSAFE], # RFC5238 | ||||||||||||||||||||||||||||||||||||||||||
| 126 | "432" => [$Sisimai::Eb::CeAUTH, "4.7.12", $Sisimai::Eb::ReSAFE], # RFC4954, RFC5321 | ||||||||||||||||||||||||||||||||||||||||||
| 127 | "451" => ["", "", $Sisimai::Eb::RePROC], # RFC2465, RFC5321 | ||||||||||||||||||||||||||||||||||||||||||
| 128 | "452" => ["", "", $Sisimai::Eb::ReDISK], # RFC5321 | ||||||||||||||||||||||||||||||||||||||||||
| 129 | "454" => [$Sisimai::Eb::CeAUTH, "4.7.0", $Sisimai::Eb::ReSAFE], # RFC3027, RFC4954 | ||||||||||||||||||||||||||||||||||||||||||
| 130 | "455" => ["", "", $Sisimai::Eb::ReCOMM], # RFC5321 | ||||||||||||||||||||||||||||||||||||||||||
| 131 | "500" => ["", "", $Sisimai::Eb::ReCOMM], # RFC5321 | ||||||||||||||||||||||||||||||||||||||||||
| 132 | "501" => ["", "", $Sisimai::Eb::ReCOMM], # RFC5321 | ||||||||||||||||||||||||||||||||||||||||||
| 133 | "502" => ["", "", $Sisimai::Eb::ReCOMM], # RFC5321 | ||||||||||||||||||||||||||||||||||||||||||
| 134 | "503" => ["", "", $Sisimai::Eb::ReCOMM], # RFC5321 | ||||||||||||||||||||||||||||||||||||||||||
| 135 | "504" => ["", "", $Sisimai::Eb::ReCOMM], # RFC5321 | ||||||||||||||||||||||||||||||||||||||||||
| 136 | "521" => [$Sisimai::Eb::CeCONN, "", $Sisimai::Eb::Re00MX], # RFC7504 | ||||||||||||||||||||||||||||||||||||||||||
| 137 | "523" => [$Sisimai::Eb::CeAUTH, "5.7.10", $Sisimai::Eb::ReSAFE], # RFC5248 | ||||||||||||||||||||||||||||||||||||||||||
| 138 | "524" => [$Sisimai::Eb::CeAUTH, "5.7.11", $Sisimai::Eb::ReSAFE], # RFC5248 | ||||||||||||||||||||||||||||||||||||||||||
| 139 | "525" => [$Sisimai::Eb::CeAUTH, "5.7.13", $Sisimai::Eb::ReSAFE], # RFC5248 | ||||||||||||||||||||||||||||||||||||||||||
| 140 | "534" => [$Sisimai::Eb::CeAUTH, "5.7.9", $Sisimai::Eb::ReSAFE], # RFC4954, RFC5248 | ||||||||||||||||||||||||||||||||||||||||||
| 141 | "535" => [$Sisimai::Eb::CeAUTH, "5.7.8", $Sisimai::Eb::ReSAFE], # RFC4954, RFC5248 | ||||||||||||||||||||||||||||||||||||||||||
| 142 | "538" => [$Sisimai::Eb::CeAUTH, "5.7.11", $Sisimai::Eb::ReSAFE], # RFC4954, RFC5248 | ||||||||||||||||||||||||||||||||||||||||||
| 143 | "551" => ["", "", $Sisimai::Eb::ReMOVE], # RFC5321, RFC5336, RFC6531 | ||||||||||||||||||||||||||||||||||||||||||
| 144 | "552" => ["", "", $Sisimai::Eb::ReFULL], # RFC5321 | ||||||||||||||||||||||||||||||||||||||||||
| 145 | "555" => ["", "", $Sisimai::Eb::ReCOMM], # RFC5321 | ||||||||||||||||||||||||||||||||||||||||||
| 146 | "556" => [$Sisimai::Eb::CeRCPT, "", $Sisimai::Eb::Re00MX], # RFC7504 | ||||||||||||||||||||||||||||||||||||||||||
| 147 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | 243 | ▶ | sub test { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
test: called CC=13 SCAR=25.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | # Check whether a reply code is a valid code or not | ||||||||||||||||||||||||||||||||||||||||||
| 151 | # @param [String] argv1 Reply Code(DSN) | ||||||||||||||||||||||||||||||||||||||||||
| 152 | # @return [Boolean] 0 = Invalid reply code, 1 = Valid reply code | ||||||||||||||||||||||||||||||||||||||||||
| 153 | # @see code | ||||||||||||||||||||||||||||||||||||||||||
| 154 | # @since v5.0.0 | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 243 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 156 | 243 | ▶ | my $argv1 = shift || return 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || (return 0)
MC/DC100%1/1
shift() || (return 0)
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 242 | my $reply = int $argv1; | |||||||||||||||||||||||||||||||||||||||||
| 158 | 242 | my $first = int($reply / 100); | |||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | 242 | ▶ | return 0 if $reply < 211; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 235 | ▶ | return 0 if $reply > 556; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 232 | ▶ | return 0 if $reply % 100 > 59; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | 228 | ▶ | if( $first == 2 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | # 2yz | ||||||||||||||||||||||||||||||||||||||||||
| 166 | 4 | ▶ | return 1 if $reply == 235; # 235 is a valid code for AUTH (RFC4954) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 3 | ▶ | return 0 if $reply > 253; # The maximum code of 2xy is 253 (RFC5248) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 3 | ▶ | return 0 if $reply > 221 && $reply < 250; # There is no reply code between 221 and 250 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$reply > 221 and $reply < 250
MC/DC50%1/2
$reply > 221 and $reply < 250
$reply > 221
$reply < 250
Truth table66%2/3
A and B
A= $reply > 221B= $reply < 250
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 224 | ▶ | if( $first == 3 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | # 3yz | ||||||||||||||||||||||||||||||||||||||||||
| 174 | 2 | ▶ | return 0 unless $reply == 334 || $reply == 354; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$reply == 334 or $reply == 354
MC/DC0%0/2
$reply == 334 or $reply == 354
$reply == 334
$reply == 354
Truth table66%2/3
A or B
A= $reply == 334B= $reply == 354
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | 2 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||
| 177 | 222 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | 10610 | ▶ | sub find { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find: called CC=20 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | # Get an SMTP reply code from the given string | ||||||||||||||||||||||||||||||||||||||||||
| 182 | # @param [String] argv1 String including SMTP reply code like 550 | ||||||||||||||||||||||||||||||||||||||||||
| 183 | # @param [String] argv2 Status code like 5.1.1 or 2 or 4 or 5 | ||||||||||||||||||||||||||||||||||||||||||
| 184 | # @return [String] SMTP reply code or empty if the first argument | ||||||||||||||||||||||||||||||||||||||||||
| 185 | # did not include SMTP Reply Code value | ||||||||||||||||||||||||||||||||||||||||||
| 186 | # @since v4.14.0 | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 10610 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 188 | 10610 | ▶ | my $argv1 = shift || return ""; return '' if length $argv1 < 3 || index(uc($argv1), 'X-UNIX;') > -1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition80%4/5
shift() || (return '')
length $argv1 < 3 or index(uc $argv1, "X-UNIX;") != -1
MC/DC100%1/1
shift() || (return '')
shift()
MC/DC50%1/2
length $argv1 < 3 or index(uc $argv1, "X-UNIX;") != -1
length $argv1 < 3
index(uc $argv1, "X-UNIX;") != -1
Truth table100%2/2
A
A= shift()
Truth table66%2/3
A or B
A= length $argv1 < 3B= index(uc $argv1, "X-UNIX;") != -1
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 10588 | ▶ | my $argv2 = shift || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || 0
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 10588 | my $esmtperror = ' '.$argv1.' '; | |||||||||||||||||||||||||||||||||||||||||
| 192 | 10588 | my $esmtpreply = ''; | |||||||||||||||||||||||||||||||||||||||||
| 193 | 10588 | ▶ | my $statuscode = substr($argv2, 0, 1) || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
substr($argv2, 0, 1) || ''
MC/DC100%1/1
substr($argv2, 0, 1) || ''
substr($argv2, 0, 1)
Truth table100%2/2
A
A= substr($argv2, 0, 1)
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | my $replycodes = $statuscode eq '5' || $statuscode eq '4' || $statuscode eq '2' | ||||||||||||||||||||||||||||||||||||||||||
| 195 | ? $CodeOfSMTP->{ $statuscode } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | 10588 | ▶ | : [$CodeOfSMTP->{'5'}->@*, $CodeOfSMTP->{'4'}->@*, $CodeOfSMTP->{'2'}->@*]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$statuscode eq 5 or $statuscode eq 4 or $statuscode eq 2
$statuscode eq 5 or $statuscode eq 4
MC/DC100%3/3
$statuscode eq 5 or $statuscode eq 4 or $statuscode eq 2
$statuscode eq 5
$statuscode eq 4
$statuscode eq 2
Truth table100%4/4
A or B or C
A= $statuscode eq 5B= $statuscode eq 4C= $statuscode eq 2
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 10588 | for my $e ( @$replycodes ) { | |||||||||||||||||||||||||||||||||||||||||
| 199 | # Try to find an SMTP Reply Code from the given string | ||||||||||||||||||||||||||||||||||||||||||
| 200 | 215781 | ▶ | my $appearance = index($esmtperror, $e); next if $appearance == -1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | 5429 | my $startingat = 1; | |||||||||||||||||||||||||||||||||||||||||
| 202 | 5429 | my $mesglength = length $esmtperror; | |||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 5429 | ▶ | while( $startingat + 3 < $mesglength ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | # Find all the reply code in the error message | ||||||||||||||||||||||||||||||||||||||||||
| 206 | 5586 | ▶ | my $replyindex = index($esmtperror, $e, $startingat); last if $replyindex == -1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 207 | 5524 | ▶ | my $formerchar = ord(substr($esmtperror, $replyindex - 1, 1)) || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
ord substr($esmtperror, $replyindex - 1, 1) || 0
MC/DC0%0/1
ord substr($esmtperror, $replyindex - 1, 1) || 0
ord substr($esmtperror, $replyindex - 1, 1)
Truth table50%1/2
A
A= ord substr($esmtperror, $replyindex - 1, 1)
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 5524 | ▶ | my $latterchar = ord(substr($esmtperror, $replyindex + 3, 1)) || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
ord substr($esmtperror, $replyindex + 3, 1) || 0
MC/DC0%0/1
ord substr($esmtperror, $replyindex + 3, 1) || 0
ord substr($esmtperror, $replyindex + 3, 1)
Truth table50%1/2
A
A= ord substr($esmtperror, $replyindex + 3, 1)
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | 5524 | ▶ | if( $formerchar > 45 && $formerchar < 58 ){ $startingat += $replyindex + 3; next } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$formerchar > 45 and $formerchar < 58
MC/DC100%2/2
$formerchar > 45 and $formerchar < 58
$formerchar > 45
$formerchar < 58
Truth table100%3/3
A and B
A= $formerchar > 45B= $formerchar < 58
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | 5322 | ▶ | if( $latterchar > 45 && $latterchar < 58 ){ $startingat += $replyindex + 3; next } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$latterchar > 45 and $latterchar < 58
MC/DC100%2/2
$latterchar > 45 and $latterchar < 58
$latterchar > 45
$latterchar < 58
Truth table100%3/3
A and B
A= $latterchar > 45B= $latterchar < 58
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 5282 | $esmtpreply = $e; | |||||||||||||||||||||||||||||||||||||||||
| 213 | 5282 | last; | |||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||
| 215 | 5429 | ▶ | last if $esmtpreply; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||
| 217 | 10588 | return $esmtpreply; | |||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | 2596 | ▶ | sub associatedwith { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
associatedwith: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | # associatedwith returns a slice associated with the SMTP reply code of the argument | ||||||||||||||||||||||||||||||||||||||||||
| 222 | # @param [String] argv1 SMTP reply code like 550 | ||||||||||||||||||||||||||||||||||||||||||
| 223 | # @return [Array] ["SMTP Command", "DSN", "Reason"] | ||||||||||||||||||||||||||||||||||||||||||
| 224 | # @since v5.2.2 | ||||||||||||||||||||||||||||||||||||||||||
| 225 | 2596 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 226 | 2596 | ▶ | my $argv1 = shift || return []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return [])
MC/DC0%0/1
shift() || (return [])
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 227 | 2596 | ▶ | return $Associated->{ $argv1 } || [] | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$Associated->{$argv1} || []
MC/DC100%1/1
$Associated->{$argv1} || []
$Associated->{$argv1}
Truth table100%2/2
A
A= $Associated->{$argv1}
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | 91 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 231 | __END__ | ||||||||||||||||||||||||||||||||||||||||||