| 1 | package Sisimai::Rhost::Cox; | ||||||||||||||||||||
| 2 | 4 | ▶ | use v5.26; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 12 | ▶ | sub find { | ||||||||||||||||||
|
Subroutine
find: called CC=8 SCAR=20.9
Pod
undocumented
| |||||||||||||||||||||
| 7 | # Detect bounce reason from https://cox.com/ | ||||||||||||||||||||
| 8 | # @param [Sisimai::Fact] argvs Decoded email object | ||||||||||||||||||||
| 9 | # @return [String] The bounce reason at Cox | ||||||||||||||||||||
| 10 | # @see | ||||||||||||||||||||
| 11 | # - Email Error Codes: https://www.cox.com/business/support/email-error-codes.html | ||||||||||||||||||||
| 12 | # - Feedback Loop Service https://www.cox.com/business/support/feedback-loop-service.html | ||||||||||||||||||||
| 13 | # @since v4.25.8 | ||||||||||||||||||||
| 14 | 12 | my $class = shift; | |||||||||||||||||||
| 15 | 12 | ▶ | my $argvs = shift // return ""; return "" unless $argvs->{'diagnosticcode'}; | ||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
shift() // (return "")
MC/DC100%1/1
shift() // (return "")
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 10 | require Sisimai::Eb; | |||||||||||||||||||
| 18 | 10 | state $errorcodes = { | |||||||||||||||||||
| 19 | # CXBL | ||||||||||||||||||||
| 20 | # - The sending IP address has been blocked by Cox due to exhibiting spam-like behavior. | ||||||||||||||||||||
| 21 | # - Send an email request to Cox to ask for a sending IP address be unblocked. | ||||||||||||||||||||
| 22 | # Note: Cox has sole discretion whether to unblock the sending IP address. | ||||||||||||||||||||
| 23 | 'CXBL' => $Sisimai::Eb::ReBLOC, | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | # CXDNS | ||||||||||||||||||||
| 26 | # - There was an issue with the connecting IP address Domain Name System (DNS). | ||||||||||||||||||||
| 27 | # - The Reverse DNS (rDNS) lookup for your IP address is failing. | ||||||||||||||||||||
| 28 | # - Confirm the IP address that sends your email. | ||||||||||||||||||||
| 29 | # - Check the rDNS of that IP address. If it passes, then wait 24 hours and try resending | ||||||||||||||||||||
| 30 | # your email. | ||||||||||||||||||||
| 31 | 'CXDNS' => $Sisimai::Eb::ReQPTR, | ||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | # CXSNDR | ||||||||||||||||||||
| 34 | # - There was a problem with the sender's domain. | ||||||||||||||||||||
| 35 | # - Your email failed authentication checks against your sending domain's SPF, DomainKeys, | ||||||||||||||||||||
| 36 | # or DKIM policy. | ||||||||||||||||||||
| 37 | 'CXSNDR' => $Sisimai::Eb::ReAUTH, | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | # CXSMTP | ||||||||||||||||||||
| 40 | # - There was a violation of SMTP protocol. | ||||||||||||||||||||
| 41 | # - Your email wasn't delivered because Cox was unable to verify that it came from a | ||||||||||||||||||||
| 42 | # legitimate email sender. | ||||||||||||||||||||
| 43 | 'CXSMTP' => $Sisimai::Eb::ReFROM, | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | # CXCNCT | ||||||||||||||||||||
| 46 | # - There was a connection issue from the IP address. | ||||||||||||||||||||
| 47 | # - There is a limit to the number of concurrent SMTP connections per IP address to | ||||||||||||||||||||
| 48 | # protect the systems against attack. Ensure that the sending email server is not | ||||||||||||||||||||
| 49 | # opening more than 10 concurrent connections to avoid reaching this limit. | ||||||||||||||||||||
| 50 | 'CXCNCT' => $Sisimai::Eb::ReRATE, | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | # CXMXRT | ||||||||||||||||||||
| 53 | # - The sender has sent email to too many recipients and needs to wait before sending | ||||||||||||||||||||
| 54 | # more email. | ||||||||||||||||||||
| 55 | # - The email sender has exceeded the maximum number of sent email allowed. | ||||||||||||||||||||
| 56 | 'CXMXRT' => $Sisimai::Eb::ReRATE, | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | # CDRBL | ||||||||||||||||||||
| 59 | # - The sending IP address has been temporarily blocked by Cox due to exhibiting spam-like | ||||||||||||||||||||
| 60 | # behavior. | ||||||||||||||||||||
| 61 | # - The block duration varies depending on reputation and other factors, but will not exceed | ||||||||||||||||||||
| 62 | # 24 hours. Inspect email traffic for potential spam, and retry email delivery. | ||||||||||||||||||||
| 63 | 'CDRBL' => $Sisimai::Eb::ReBLOC, | ||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | 'CXTHRT' => $Sisimai::Eb::ReSAFE, # Email sending limited due to suspicious account activity. | ||||||||||||||||||||
| 66 | 'CXMJ' => $Sisimai::Eb::ReSAFE, # Email sending blocked due to suspicious account activity on primary Cox account. | ||||||||||||||||||||
| 67 | 'IPBL0001' => $Sisimai::Eb::ReBLOC, # The sending IP address is listed in the Spamhaus Zen DNSBL. | ||||||||||||||||||||
| 68 | 'IPBL0010' => $Sisiami::Eb::ReBLOC, # The sending IP is listed in the Return Path DNSBL. | ||||||||||||||||||||
| 69 | 'IPBL0100' => $Sisimai::Eb::ReBLOC, # The sending IP is listed in the Invaluement ivmSIP DNSBL. | ||||||||||||||||||||
| 70 | 'IPBL0011' => $Sisimai::Eb::ReBLOC, # The sending IP is in the Spamhaus Zen and Return Path DNSBLs. | ||||||||||||||||||||
| 71 | 'IPBL0101' => $Sisimai::Eb::ReBLOC, # The sending IP is in the Spamhaus Zen and Invaluement ivmSIP DNSBLs. | ||||||||||||||||||||
| 72 | 'IPBL0110' => $Sisimai::Eb::ReBLOC, # The sending IP is in the Return Path and Invaluement ivmSIP DNSBLs. | ||||||||||||||||||||
| 73 | 'IPBL0111' => $Sisimai::Eb::ReBLOC, # The sending IP is in the Spamhaus Zen, Return Path and Invaluement ivmSIP DNSBLs. | ||||||||||||||||||||
| 74 | 'IPBL1000' => $Sisimai::Eb::ReBLOC, # The sending IP address is listed on a CSI blacklist. | ||||||||||||||||||||
| 75 | 'IPBL1001' => $Sisimai::Eb::ReBLOC, # The sending IP is listed in the Cloudmark CSI and Spamhaus Zen DNSBLs. | ||||||||||||||||||||
| 76 | 'IPBL1010' => $Sisimai::Eb::ReBLOC, # The sending IP is listed in the Cloudmark CSI and Return Path DNSBLs. | ||||||||||||||||||||
| 77 | 'IPBL1011' => $Sisimai::Eb::ReBLOC, # The sending IP is in the Cloudmark CSI, Spamhaus Zen and Return Path DNSBLs. | ||||||||||||||||||||
| 78 | 'IPBL1100' => $Sisimai::Eb::ReBLOC, # The sending IP is listed in the Cloudmark CSI and Invaluement ivmSIP DNSBLs. | ||||||||||||||||||||
| 79 | 'IPBL1101' => $Sisimai::Eb::ReBLOC, # The sending IP is in the Cloudmark CSI, Spamhaus Zen and Invaluement IVMsip DNSBLs. | ||||||||||||||||||||
| 80 | 'IPBL1110' => $Sisimai::Eb::ReBLOC, # The sending IP is in the Cloudmark CSI, Return Path and Invaluement ivmSIP DNSBLs. | ||||||||||||||||||||
| 81 | 'IPBL1111' => $Sisimai::Eb::ReBLOC, # The sending IP is in the Cloudmark CSI, Spamhaus Zen, Return Path and Invaluement ivmSIP DNSBLs. | ||||||||||||||||||||
| 82 | 'IPBL00001' => $Sisimai::Eb::ReBLOC, # The sending IP address is listed on a Spamhaus blacklist. | ||||||||||||||||||||
| 83 | |||||||||||||||||||||
| 84 | 'URLBL011' => $Sisimai::Eb::ReSPAM, # A URL within the body of the message was found on blocklists SURBL and Spamhaus DBL. | ||||||||||||||||||||
| 85 | 'URLBL101' => $Sisimai::Eb::ReSPAM, # A URL within the body of the message was found on blocklists SURBL and ivmURI. | ||||||||||||||||||||
| 86 | 'URLBL110' => $Sisimai::Eb::ReSPAM, # A URL within the body of the message was found on blocklists Spamhaus DBL and ivmURI. | ||||||||||||||||||||
| 87 | 'URLBL1001' => $Sisimai::Eb::ReSPAM, # The URL is listed on a Spamhaus blacklist. | ||||||||||||||||||||
| 88 | }; | ||||||||||||||||||||
| 89 | 10 | state $messagesof = { | |||||||||||||||||||
| 90 | $Sisimai::Eb::ReBLOC => [ | ||||||||||||||||||||
| 91 | # - An email client has repeatedly sent bad commands or invalid passwords resulting in | ||||||||||||||||||||
| 92 | # a three-hour block of the client's IP address. | ||||||||||||||||||||
| 93 | # - The sending IP address has exceeded the threshold of invalid recipients and has | ||||||||||||||||||||
| 94 | # been blocked. | ||||||||||||||||||||
| 95 | 'cox too many bad commands from', | ||||||||||||||||||||
| 96 | 'too many invalid recipients', | ||||||||||||||||||||
| 97 | ], | ||||||||||||||||||||
| 98 | $Sisimai::Eb::ReBODY => [ | ||||||||||||||||||||
| 99 | # - The message has been rejected because it contains an attachment with one of the | ||||||||||||||||||||
| 100 | # following prohibited file types, which commonly contain viruses: .shb, .shs, .vbe, | ||||||||||||||||||||
| 101 | # .vbs, .wsc, .wsf, .wsh, .pif, .msc, .msi, .msp, .reg, .sct, .bat, .chm, .isp, .cpl, | ||||||||||||||||||||
| 102 | # .js, .jse, .scr, .exe. | ||||||||||||||||||||
| 103 | 'attachment extension is forbidden', | ||||||||||||||||||||
| 104 | ], | ||||||||||||||||||||
| 105 | $Sisimai::Eb::ReWONT => [ | ||||||||||||||||||||
| 106 | # - The sending server has attempted to communicate too soon within the SMTP transaction | ||||||||||||||||||||
| 107 | 'esmtp no data before greeting', | ||||||||||||||||||||
| 108 | ], | ||||||||||||||||||||
| 109 | $Sisimai::Eb::ReRATE => [ | ||||||||||||||||||||
| 110 | # - The sending IP address has exceeded the five maximum concurrent connection limit. | ||||||||||||||||||||
| 111 | # - The SMTP connection has exceeded the 100 email message threshold and was disconnected. | ||||||||||||||||||||
| 112 | # - The sending IP address has exceeded one of these rate limits and has been temporarily | ||||||||||||||||||||
| 113 | # blocked. | ||||||||||||||||||||
| 114 | # - Cox enforces various rate limits to protect our platform. The sending IP address | ||||||||||||||||||||
| 115 | # has exceeded one of these rate limits and has been temporarily blocked. | ||||||||||||||||||||
| 116 | 'too many sessions from', | ||||||||||||||||||||
| 117 | 'requested action aborted: try again later', | ||||||||||||||||||||
| 118 | 'message threshold exceeded', | ||||||||||||||||||||
| 119 | ], | ||||||||||||||||||||
| 120 | $Sisimai::Eb::ReFROM => [ | ||||||||||||||||||||
| 121 | # Cox requires that all sender domains resolve to a valid MX or A-record within DNS. | ||||||||||||||||||||
| 122 | 'sender rejected', | ||||||||||||||||||||
| 123 | ], | ||||||||||||||||||||
| 124 | $Sisimai::Eb::ReQPTR => [ | ||||||||||||||||||||
| 125 | # - The reverse DNS check of the sending server IP address has failed. | ||||||||||||||||||||
| 126 | # - Cox requires that all connecting email servers contain valid reverse DNS PTR records. | ||||||||||||||||||||
| 127 | 'dns check failure - try again later', | ||||||||||||||||||||
| 128 | 'rejected - no rdns', | ||||||||||||||||||||
| 129 | ], | ||||||||||||||||||||
| 130 | $Sisimai::Eb::RePROC => [ | ||||||||||||||||||||
| 131 | # - Our systems are experiencing an issue which is causing a temporary inability to | ||||||||||||||||||||
| 132 | # accept new email. | ||||||||||||||||||||
| 133 | 'esmtp server temporarily not available', | ||||||||||||||||||||
| 134 | ], | ||||||||||||||||||||
| 135 | $Sisimai::Eb::ReUSER => [ | ||||||||||||||||||||
| 136 | # - The intended recipient is not a valid Cox Email account. | ||||||||||||||||||||
| 137 | 'recipient rejected', | ||||||||||||||||||||
| 138 | ], | ||||||||||||||||||||
| 139 | }; | ||||||||||||||||||||
| 140 | 10 | my $issuedcode = $argvs->{'diagnosticcode'}; | |||||||||||||||||||
| 141 | 10 | ▶ | my $codenumber = $issuedcode =~ m/AUP#([0-9A-Z]+)/ ? $1 : 0; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 142 | 10 | ▶ | my $reasontext = $errorcodes->{ $codenumber } || ''; | ||||||||||||||||||
|
Condition100%2/2
$errorcodes->{$codenumber} || ''
MC/DC100%1/1
$errorcodes->{$codenumber} || ''
$errorcodes->{$codenumber}
Truth table100%2/2
A
A= $errorcodes->{$codenumber}
| |||||||||||||||||||||
| 143 | |||||||||||||||||||||
| 144 | 10 | ▶ | unless( $reasontext ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 145 | # The error code was not found in $errorcodes | ||||||||||||||||||||
| 146 | 2 | $issuedcode = lc $issuedcode; | |||||||||||||||||||
| 147 | 2 | for my $e ( keys %$messagesof ) { | |||||||||||||||||||
| 148 | # Try to find with each error message defined in $messagesof | ||||||||||||||||||||
| 149 | 16 | ▶ | next unless grep { index($issuedcode, $_) > -1 } $messagesof->{ $e }->@*; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 150 | 0 | $reasontext = $e; | |||||||||||||||||||
| 151 | 0 | last; | |||||||||||||||||||
| 152 | } | ||||||||||||||||||||
| 153 | } | ||||||||||||||||||||
| 154 | 10 | return $reasontext; | |||||||||||||||||||
| 155 | } | ||||||||||||||||||||
| 156 | |||||||||||||||||||||
| 157 | 4 | 1; | |||||||||||||||||||
| 158 | __END__ | ||||||||||||||||||||