| 1 | package Sisimai::Lhost::Gmail; | ||||||||||||||||||||||||||||
| 2 | 39 | ▶ | use parent 'Sisimai::Lhost'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 39 | ▶ | use v5.26; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 39 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 39 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | sub description { 'Gmail: https://mail.google.com/' } | ||||||||||||||||||||||||||
|
Subroutine
description: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 8 | 1045 | ▶ | sub inquire { | ||||||||||||||||||||||||||
|
Subroutine
inquire: called CC=31 SCAR=34.9
Pod
documented
| |||||||||||||||||||||||||||||
| 9 | # Detect an error from Gmail | ||||||||||||||||||||||||||||
| 10 | # @param [Hash] mhead Message headers of a bounce email | ||||||||||||||||||||||||||||
| 11 | # @param [String] mbody Message body of a bounce email | ||||||||||||||||||||||||||||
| 12 | # @return [Hash] Bounce data list and message/rfc822 part | ||||||||||||||||||||||||||||
| 13 | # @return [undef] failed to decode or the arguments are missing | ||||||||||||||||||||||||||||
| 14 | # @since v4.0.0 | ||||||||||||||||||||||||||||
| 15 | 1045 | my $class = shift; | |||||||||||||||||||||||||||
| 16 | 1045 | ▶ | my $mhead = shift // return undef; | ||||||||||||||||||||||||||
|
Condition100%2/2
shift() // (return undef)
MC/DC100%1/1
shift() // (return undef)
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 17 | 1044 | ▶ | my $mbody = shift // return undef; | ||||||||||||||||||||||||||
|
Condition100%2/2
shift() // (return undef)
MC/DC100%1/1
shift() // (return undef)
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | # Google Mail | ||||||||||||||||||||||||||||
| 20 | # From: Mail Delivery Subsystem <mailer-daemon@googlemail.com> | ||||||||||||||||||||||||||||
| 21 | # Received: from vw-in-f109.1e100.net [74.125.113.109] by ... | ||||||||||||||||||||||||||||
| 22 | # | ||||||||||||||||||||||||||||
| 23 | # * Check the body part | ||||||||||||||||||||||||||||
| 24 | # This is an automatically generated Delivery Status Notification | ||||||||||||||||||||||||||||
| 25 | # Delivery to the following recipient failed permanently: | ||||||||||||||||||||||||||||
| 26 | # | ||||||||||||||||||||||||||||
| 27 | # recipient-address-here@example.jp | ||||||||||||||||||||||||||||
| 28 | # | ||||||||||||||||||||||||||||
| 29 | # Technical details of permanent failure: | ||||||||||||||||||||||||||||
| 30 | # Google tried to deliver your message, but it was rejected by the | ||||||||||||||||||||||||||||
| 31 | # recipient domain. We recommend contacting the other email provider | ||||||||||||||||||||||||||||
| 32 | # for further information about the cause of this error. The error | ||||||||||||||||||||||||||||
| 33 | # that the other server returned was: | ||||||||||||||||||||||||||||
| 34 | # 550 550 <recipient-address-heare@example.jp>: User unknown (state 14). | ||||||||||||||||||||||||||||
| 35 | # | ||||||||||||||||||||||||||||
| 36 | # -- OR -- | ||||||||||||||||||||||||||||
| 37 | # THIS IS A WARNING MESSAGE ONLY. | ||||||||||||||||||||||||||||
| 38 | # | ||||||||||||||||||||||||||||
| 39 | # YOU DO NOT NEED TO RESEND YOUR MESSAGE. | ||||||||||||||||||||||||||||
| 40 | # | ||||||||||||||||||||||||||||
| 41 | # Delivery to the following recipient has been delayed: | ||||||||||||||||||||||||||||
| 42 | # | ||||||||||||||||||||||||||||
| 43 | # mailboxfull@example.jp | ||||||||||||||||||||||||||||
| 44 | # | ||||||||||||||||||||||||||||
| 45 | # Message will be retried for 2 more day(s) | ||||||||||||||||||||||||||||
| 46 | # | ||||||||||||||||||||||||||||
| 47 | # Technical details of temporary failure: | ||||||||||||||||||||||||||||
| 48 | # Google tried to deliver your message, but it was rejected by the recipient | ||||||||||||||||||||||||||||
| 49 | # domain. We recommend contacting the other email provider for further infor- | ||||||||||||||||||||||||||||
| 50 | # mation about the cause of this error. The error that the other server re- | ||||||||||||||||||||||||||||
| 51 | # turned was: 450 450 4.2.2 <mailboxfull@example.jp>... Mailbox Full (state 14). | ||||||||||||||||||||||||||||
| 52 | # | ||||||||||||||||||||||||||||
| 53 | # -- OR -- | ||||||||||||||||||||||||||||
| 54 | # | ||||||||||||||||||||||||||||
| 55 | # Delivery to the following recipient failed permanently: | ||||||||||||||||||||||||||||
| 56 | # | ||||||||||||||||||||||||||||
| 57 | # userunknown@example.jp | ||||||||||||||||||||||||||||
| 58 | # | ||||||||||||||||||||||||||||
| 59 | # Technical details of permanent failure:=20 | ||||||||||||||||||||||||||||
| 60 | # Google tried to deliver your message, but it was rejected by the server for= | ||||||||||||||||||||||||||||
| 61 | # the recipient domain example.jp by mx.example.jp. [192.0.2.59]. | ||||||||||||||||||||||||||||
| 62 | # | ||||||||||||||||||||||||||||
| 63 | # The error that the other server returned was: | ||||||||||||||||||||||||||||
| 64 | # 550 5.1.1 <userunknown@example.jp>... User Unknown | ||||||||||||||||||||||||||||
| 65 | # | ||||||||||||||||||||||||||||
| 66 | 1043 | ▶ | return undef unless rindex($mhead->{'from'}, '<mailer-daemon@googlemail.com>') > -1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 67 | 312 | ▶ | return undef unless index($mhead->{'subject'}, 'Delivery Status Notification') > -1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 312 | require Sisimai::Eb; | |||||||||||||||||||||||||||
| 70 | 312 | state $indicators = __PACKAGE__->INDICATORS; | |||||||||||||||||||||||||||
| 71 | 312 | state $boundaries = ['----- Original message -----', '----- Message header follows -----']; | |||||||||||||||||||||||||||
| 72 | 312 | state $startingof = { | |||||||||||||||||||||||||||
| 73 | 'message' => ['Delivery to the following recipient'], | ||||||||||||||||||||||||||||
| 74 | 'error' => ['The error that the other server returned was:'], | ||||||||||||||||||||||||||||
| 75 | }; | ||||||||||||||||||||||||||||
| 76 | 312 | state $statetable = { | |||||||||||||||||||||||||||
| 77 | # Technical details of permanent failure: | ||||||||||||||||||||||||||||
| 78 | # Google tried to deliver your message, but it was rejected by the recipient domain. | ||||||||||||||||||||||||||||
| 79 | # We recommend contacting the other email provider for further information about the | ||||||||||||||||||||||||||||
| 80 | # cause of this error. The error that the other server returned was: | ||||||||||||||||||||||||||||
| 81 | # 500 Remote server does not support TLS (state 6). | ||||||||||||||||||||||||||||
| 82 | '6' => { 'command' => $Sisimai::Eb::CeMAIL, 'reason' => $Sisimai::Eb::ReTTLS }, | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | # https://www.google.td/support/forum/p/gmail/thread?tid=08a60ebf5db24f7b&hl=en | ||||||||||||||||||||||||||||
| 85 | # Technical details of permanent failure: | ||||||||||||||||||||||||||||
| 86 | # Google tried to deliver your message, but it was rejected by the recipient domain. | ||||||||||||||||||||||||||||
| 87 | # We recommend contacting the other email provider for further information about the | ||||||||||||||||||||||||||||
| 88 | # cause of this error. The error that the other server returned was: | ||||||||||||||||||||||||||||
| 89 | # 535 SMTP AUTH failed with the remote server. (state 8). | ||||||||||||||||||||||||||||
| 90 | '8' => { 'command' => $Sisimai::Eb::CeAUTH, 'reason' => $Sisimai::Eb::RePROC }, | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | # https://www.google.co.nz/support/forum/p/gmail/thread?tid=45208164dbca9d24&hl=en | ||||||||||||||||||||||||||||
| 93 | # Technical details of temporary failure: | ||||||||||||||||||||||||||||
| 94 | # Google tried to deliver your message, but it was rejected by the recipient domain. | ||||||||||||||||||||||||||||
| 95 | # We recommend contacting the other email provider for further information about the | ||||||||||||||||||||||||||||
| 96 | # cause of this error. The error that the other server returned was: | ||||||||||||||||||||||||||||
| 97 | # 454 454 TLS missing certificate: error:0200100D:system library:fopen:Permission denied (#4.3.0) (state 9). | ||||||||||||||||||||||||||||
| 98 | '9' => { 'command' => $Sisimai::Eb::CeAUTH, 'reason' => $Sisimai::Eb::ReTTLS }, | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | # https://www.google.com/support/forum/p/gmail/thread?tid=5cfab8c76ec88638&hl=en | ||||||||||||||||||||||||||||
| 101 | # Technical details of permanent failure: | ||||||||||||||||||||||||||||
| 102 | # Google tried to deliver your message, but it was rejected by the recipient domain. | ||||||||||||||||||||||||||||
| 103 | # We recommend contacting the other email provider for further information about the | ||||||||||||||||||||||||||||
| 104 | # cause of this error. The error that the other server returned was: | ||||||||||||||||||||||||||||
| 105 | # 500 Remote server does not support SMTP Authenticated Relay (state 12). | ||||||||||||||||||||||||||||
| 106 | '12' => { 'command' => $Sisimai::Eb::CeAUTH, 'reason' => $Sisimai::Eb::RePASS }, | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | # Technical details of permanent failure: | ||||||||||||||||||||||||||||
| 109 | # Google tried to deliver your message, but it was rejected by the recipient domain. | ||||||||||||||||||||||||||||
| 110 | # We recommend contacting the other email provider for further information about the | ||||||||||||||||||||||||||||
| 111 | # cause of this error. The error that the other server returned was: | ||||||||||||||||||||||||||||
| 112 | # 550 550 5.7.1 <****@gmail.com>... Access denied (state 13). | ||||||||||||||||||||||||||||
| 113 | '13' => { 'command' => $Sisimai::Eb::CeEHLO, 'reason' => $Sisimai::Eb::BLOC }, | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | # Technical details of permanent failure: | ||||||||||||||||||||||||||||
| 116 | # Google tried to deliver your message, but it was rejected by the recipient domain. | ||||||||||||||||||||||||||||
| 117 | # We recommend contacting the other email provider for further information about the | ||||||||||||||||||||||||||||
| 118 | # cause of this error. The error that the other server returned was: | ||||||||||||||||||||||||||||
| 119 | # 550 550 5.1.1 <******@*********.**>... User Unknown (state 14). | ||||||||||||||||||||||||||||
| 120 | # 550 550 5.2.2 <*****@****.**>... Mailbox Full (state 14). | ||||||||||||||||||||||||||||
| 121 | '14' => { 'command' => $Sisimai::Eb::CeRCPT, 'reason' => $Sisimai::Eb::ReUSER }, | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | # https://www.google.cz/support/forum/p/gmail/thread?tid=7090cbfd111a24f9&hl=en | ||||||||||||||||||||||||||||
| 124 | # Technical details of permanent failure: | ||||||||||||||||||||||||||||
| 125 | # Google tried to deliver your message, but it was rejected by the recipient domain. | ||||||||||||||||||||||||||||
| 126 | # We recommend contacting the other email provider for further information about the | ||||||||||||||||||||||||||||
| 127 | # cause of this error. The error that the other server returned was: | ||||||||||||||||||||||||||||
| 128 | # 550 550 5.7.1 SPF unauthorized mail is prohibited. (state 15). | ||||||||||||||||||||||||||||
| 129 | # 554 554 Error: no valid recipients (state 15). | ||||||||||||||||||||||||||||
| 130 | '15' => { 'command' => $Sisimai::Eb::CeDATA, 'reason' => $Sisimai::Eb::ReFILT }, | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | # https://www.google.com/support/forum/p/Google%20Apps/thread?tid=0aac163bc9c65d8e&hl=en | ||||||||||||||||||||||||||||
| 133 | # Technical details of permanent failure: | ||||||||||||||||||||||||||||
| 134 | # Google tried to deliver your message, but it was rejected by the recipient domain. | ||||||||||||||||||||||||||||
| 135 | # We recommend contacting the other email provider for further information about the | ||||||||||||||||||||||||||||
| 136 | # cause of this error. The error that the other server returned was: | ||||||||||||||||||||||||||||
| 137 | # 550 550 <****@***.**> No such user here (state 17). | ||||||||||||||||||||||||||||
| 138 | # 550 550 #5.1.0 Address rejected ***@***.*** (state 17). | ||||||||||||||||||||||||||||
| 139 | '17' => { 'command' => $Sisimai::Eb::CeDATA, 'reason' => $Sisimai::Eb::ReFILT }, | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | # Technical details of permanent failure: | ||||||||||||||||||||||||||||
| 142 | # Google tried to deliver your message, but it was rejected by the recipient domain. | ||||||||||||||||||||||||||||
| 143 | # We recommend contacting the other email provider for further information about the | ||||||||||||||||||||||||||||
| 144 | # cause of this error. The error that the other server returned was: | ||||||||||||||||||||||||||||
| 145 | # 550 550 Unknown user *****@***.**.*** (state 18). | ||||||||||||||||||||||||||||
| 146 | '18' => { 'command' => $Sisimai::Eb::CeDATA, 'reason' => $Sisimai::Eb::ReFILT }, | ||||||||||||||||||||||||||||
| 147 | }; | ||||||||||||||||||||||||||||
| 148 | 312 | require Sisimai::Address; | |||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | 312 | ▶ | my $emailparts = Sisimai::RFC5322->part($mbody, $boundaries) // return undef; return undef unless $emailparts->[0]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
"Sisimai::RFC5322"->part($mbody, $boundaries) // (return undef)
MC/DC0%0/1
"Sisimai::RFC5322"->part($mbody, $boundaries) // (return undef)
"Sisimai::RFC5322"->part($mbody, $boundaries)
Truth table50%1/2
A
A= "Sisimai::RFC5322"->part($mbody, $boundaries)
| |||||||||||||||||||||||||||||
| 151 | 312 | my $dscontents = [__PACKAGE__->DELIVERYSTATUS]; my $v = undef; | |||||||||||||||||||||||||||
| 152 | 312 | my $readcursor = 0; # (Integer) Points the current cursor position | |||||||||||||||||||||||||||
| 153 | 312 | my $recipients = 0; # (Integer) The number of 'Final-Recipient' header | |||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 312 | for my $e ( split("\n", $emailparts->[0]) ) { | |||||||||||||||||||||||||||
| 156 | # Read error messages and delivery status lines from the head of the email to the previous | ||||||||||||||||||||||||||||
| 157 | # line of the beginning of the original message. | ||||||||||||||||||||||||||||
| 158 | 13181 | ▶ | unless( $readcursor ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 159 | # Beginning of the bounce message or message/delivery-status part | ||||||||||||||||||||||||||||
| 160 | 12703 | ▶ | $readcursor |= $indicators->{'deliverystatus'} if index($e, $startingof->{'message'}->[0]) == 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||
| 162 | 13181 | ▶ | next if ($readcursor & $indicators->{'deliverystatus'}) == 0 || $e eq ""; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
($readcursor & $indicators->{"deliverystatus"}) == 0 or $e eq ""
MC/DC100%2/2
($readcursor & $indicators->{"deliverystatus"}) == 0 or $e eq ""
($readcursor & $indicators->{"deliverystatus"}) == 0
$e eq ""
Truth table100%3/3
A or B
A= ($readcursor & $indicators->{"deliverystatus"}) == 0B= $e eq ""
| |||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | # Technical details of permanent failure:=20 | ||||||||||||||||||||||||||||
| 165 | # Google tried to deliver your message, but it was rejected by the recipient = | ||||||||||||||||||||||||||||
| 166 | # domain. We recommend contacting the other email provider for further inform= | ||||||||||||||||||||||||||||
| 167 | # ation about the cause of this error. The error that the other server return= | ||||||||||||||||||||||||||||
| 168 | # ed was: 554 554 5.7.0 Header error (state 18). | ||||||||||||||||||||||||||||
| 169 | # | ||||||||||||||||||||||||||||
| 170 | # -- OR -- | ||||||||||||||||||||||||||||
| 171 | # | ||||||||||||||||||||||||||||
| 172 | # Technical details of permanent failure:=20 | ||||||||||||||||||||||||||||
| 173 | # Google tried to deliver your message, but it was rejected by the server for= | ||||||||||||||||||||||||||||
| 174 | # the recipient domain example.jp by mx.example.jp. [192.0.2.49]. | ||||||||||||||||||||||||||||
| 175 | # | ||||||||||||||||||||||||||||
| 176 | # The error that the other server returned was: | ||||||||||||||||||||||||||||
| 177 | # 550 5.1.1 <userunknown@example.jp>... User Unknown | ||||||||||||||||||||||||||||
| 178 | # | ||||||||||||||||||||||||||||
| 179 | 376 | $v = $dscontents->[-1]; | |||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | 376 | ▶ | if( index($e, ' ') == 0 && index($e, '@') > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
index($e, " ") == 0 and index($e, "\@") > 0
MC/DC50%1/2
index($e, " ") == 0 and index($e, "\@") > 0
index($e, " ") == 0
index($e, "\@") > 0
Truth table66%2/3
A and B
A= index($e, " ") == 0B= index($e, "\@") > 0
| |||||||||||||||||||||||||||||
| 182 | # kijitora@example.jp: 550 5.2.2 <kijitora@example>... Mailbox Full | ||||||||||||||||||||||||||||
| 183 | 76 | ▶ | if( $v->{'recipient'} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 184 | # There are multiple recipient addresses in the message body. | ||||||||||||||||||||||||||||
| 185 | 0 | push @$dscontents, __PACKAGE__->DELIVERYSTATUS; | |||||||||||||||||||||||||||
| 186 | 0 | $v = $dscontents->[-1]; | |||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | 76 | my $r = Sisimai::Address->s3s4(substr($e, rindex($e, ' ') + 1,)); | |||||||||||||||||||||||||||
| 190 | 76 | ▶ | next unless Sisimai::Address->is_emailaddress($r); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 191 | 76 | $v->{'recipient'} = $r; | |||||||||||||||||||||||||||
| 192 | 76 | $recipients++; | |||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | } else { | ||||||||||||||||||||||||||||
| 195 | 300 | $v->{'diagnosis'} .= $e.' '; | |||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||
| 198 | 312 | ▶ | return undef unless $recipients; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | 76 | require Sisimai::String; | |||||||||||||||||||||||||||
| 201 | 76 | require Sisimai::RFC1123; | |||||||||||||||||||||||||||
| 202 | 76 | for my $e ( @$dscontents ) { | |||||||||||||||||||||||||||
| 203 | # Get the value of remote host | ||||||||||||||||||||||||||||
| 204 | 76 | ▶ | if( Sisimai::String->aligned(\$e->{'diagnosis'}, [' by ', '. [', ']. ']) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 205 | # Google tried to deliver your message, but it was rejected by the server for the recipient | ||||||||||||||||||||||||||||
| 206 | # domain example.jp by mx.example.jp. [192.0.2.153]. | ||||||||||||||||||||||||||||
| 207 | 11 | my $p1 = rindex($e->{'diagnosis'}, ' by '); | |||||||||||||||||||||||||||
| 208 | 11 | my $p2 = rindex($e->{'diagnosis'}, '. [' ); | |||||||||||||||||||||||||||
| 209 | 11 | my $hostname = substr($e->{'diagnosis'}, $p1 + 4, $p2 - $p1 - 4); | |||||||||||||||||||||||||||
| 210 | 11 | my $ipv4addr = substr($e->{'diagnosis'}, $p2 + 3, rindex($e->{'diagnosis'}, ']. ') - $p2 - 3); | |||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | 11 | ▶ | $e->{'rhost'} = $hostname if Sisimai::RFC1123->is_internethost($hostname); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 213 | 11 | ▶ | $e->{'rhost'} ||= $ipv4addr; | ||||||||||||||||||||||||||
|
Condition33%1/3
$e->{"rhost"} ||= $ipv4addr
MC/DC0%0/2
$e->{"rhost"} ||= $ipv4addr
$e->{"rhost"}
$ipv4addr
Truth table33%1/3
A ||= B
A= $e->{"rhost"}B= $ipv4addr
| |||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | 76 | while(1) { | |||||||||||||||||||||||||||
| 217 | # Find "(state 18)" and pick "18" as a key of statetable | ||||||||||||||||||||||||||||
| 218 | 76 | ▶ | my $p1 = rindex($e->{'diagnosis'}, ' (state '); last if $p1 < 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 219 | 30 | ▶ | my $p2 = rindex($e->{'diagnosis'}, ')'); last if $p1 < 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 220 | 30 | ▶ | last if $p1 > $p2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 221 | 30 | my $cu = substr($e->{'diagnosis'}, $p1 + 8, $p2 - $p1 - 8); | |||||||||||||||||||||||||||
| 222 | 30 | ▶ | last unless $cu; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | 30 | $e->{'reason'} = $statetable->{ $cu }->{'reason'}; | |||||||||||||||||||||||||||
| 225 | 30 | $e->{'command'} = $statetable->{ $cu }->{'command'}; | |||||||||||||||||||||||||||
| 226 | 30 | last; | |||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | 76 | ▶ | $e->{'reason'} ||= ''; next unless $e->{'reason'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$e->{"reason"} ||= ""
MC/DC100%1/1
$e->{"reason"} ||= ""
$e->{"reason"}
Truth table100%2/2
A
A= $e->{"reason"}
| |||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | # Set pseudo status code and override bounce reason | ||||||||||||||||||||||||||||
| 231 | 20 | ▶ | $e->{'status'} = Sisimai::SMTP::Status->find($e->{'diagnosis'}) || ''; | ||||||||||||||||||||||||||
|
Condition100%2/2
'Sisimai::SMTP::Status'->find($e->{'diagnosis'}) || ''
MC/DC100%1/1
'Sisimai::SMTP::Status'->find($e->{'diagnosis'}) || ''
'Sisimai::SMTP::Status'->find($e->{'diagnosis'})
Truth table100%2/2
A
A= 'Sisimai::SMTP::Status'->find($e->{'diagnosis'})
| |||||||||||||||||||||||||||||
| 232 | 20 | ▶ | next if length($e->{'status'}) == 0 || index($e->{'status'}, '.0') > 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
length $e->{"status"} == 0 or index($e->{"status"}, ".0") > 0
MC/DC100%2/2
length $e->{"status"} == 0 or index($e->{"status"}, ".0") > 0
length $e->{"status"} == 0
index($e->{"status"}, ".0") > 0
Truth table100%3/3
A or B
A= length $e->{"status"} == 0B= index($e->{"status"}, ".0") > 0
| |||||||||||||||||||||||||||||
| 233 | 10 | ▶ | $e->{'reason'} = Sisimai::SMTP::Status->name($e->{'status'}) || ''; | ||||||||||||||||||||||||||
|
Condition50%1/2
'Sisimai::SMTP::Status'->name($e->{'status'}) || ''
MC/DC0%0/1
'Sisimai::SMTP::Status'->name($e->{'status'}) || ''
'Sisimai::SMTP::Status'->name($e->{'status'})
Truth table50%1/2
A
A= 'Sisimai::SMTP::Status'->name($e->{'status'})
| |||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||
| 235 | 76 | return {"ds" => $dscontents, "rfc822" => $emailparts->[1]}; | |||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 39 | 1; | |||||||||||||||||||||||||||
| 239 | __END__ | ||||||||||||||||||||||||||||