| 1 | package Sisimai::Lhost::V5sendmail; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 35 | ▶ | use parent 'Sisimai::Lhost'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 35 | ▶ | use v5.26; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 35 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 35 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | sub description { 'Sendmail version 5' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
description: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 908 | ▶ | sub inquire { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inquire: called CC=40 SCAR=38.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | # Detect an error from V5sendmail | ||||||||||||||||||||||||||||||||||||||||||
| 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.1.2 | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 908 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 16 | 908 | ▶ | 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 | 907 | ▶ | 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 | 906 | ▶ | return undef unless $mhead->{'subject'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 888 | ▶ | return undef if index($mhead->{'subject'}, 'Returned mail: ') != 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 81 | state $indicators = __PACKAGE__->INDICATORS; | |||||||||||||||||||||||||||||||||||||||||
| 23 | 81 | state $boundaries = [' ----- Unsent message follows -----', ' ----- No message was collected -----']; | |||||||||||||||||||||||||||||||||||||||||
| 24 | 81 | state $startingof = { | |||||||||||||||||||||||||||||||||||||||||
| 25 | # Error text regular expressions which defined in src/savemail.c | ||||||||||||||||||||||||||||||||||||||||||
| 26 | # savemail.c:485| (void) fflush(stdout); | ||||||||||||||||||||||||||||||||||||||||||
| 27 | # savemail.c:486| p = queuename(e->e_parent, 'x'); | ||||||||||||||||||||||||||||||||||||||||||
| 28 | # savemail.c:487| if ((xfile = fopen(p, "r")) == NULL) | ||||||||||||||||||||||||||||||||||||||||||
| 29 | # savemail.c:488| { | ||||||||||||||||||||||||||||||||||||||||||
| 30 | # savemail.c:489| syserr("Cannot open %s", p); | ||||||||||||||||||||||||||||||||||||||||||
| 31 | # savemail.c:490| fprintf(fp, " ----- Transcript of session is unavailable -----\n"); | ||||||||||||||||||||||||||||||||||||||||||
| 32 | # savemail.c:491| } | ||||||||||||||||||||||||||||||||||||||||||
| 33 | # savemail.c:492| else | ||||||||||||||||||||||||||||||||||||||||||
| 34 | # savemail.c:493| { | ||||||||||||||||||||||||||||||||||||||||||
| 35 | # savemail.c:494| fprintf(fp, " ----- Transcript of session follows -----\n"); | ||||||||||||||||||||||||||||||||||||||||||
| 36 | # savemail.c:495| if (e->e_xfp != NULL) | ||||||||||||||||||||||||||||||||||||||||||
| 37 | # savemail.c:496| (void) fflush(e->e_xfp); | ||||||||||||||||||||||||||||||||||||||||||
| 38 | # savemail.c:497| while (fgets(buf, sizeof buf, xfile) != NULL) | ||||||||||||||||||||||||||||||||||||||||||
| 39 | # savemail.c:498| putline(buf, fp, m); | ||||||||||||||||||||||||||||||||||||||||||
| 40 | # savemail.c:499| (void) fclose(xfile); | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 'error' => ['While talking to '], | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 'message' => ['----- Transcript of session follows -----'], | ||||||||||||||||||||||||||||||||||||||||||
| 43 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 81 | my $emailparts = Sisimai::RFC5322->part($mbody, $boundaries); | |||||||||||||||||||||||||||||||||||||||||
| 46 | 81 | ▶ | return undef if ref($emailparts) ne 'ARRAY' || length($emailparts->[1]) == 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $emailparts ne "ARRAY" or length $emailparts->[1] == 0
MC/DC50%1/2
ref $emailparts ne "ARRAY" or length $emailparts->[1] == 0
ref $emailparts ne "ARRAY"
length $emailparts->[1] == 0
Truth table66%2/3
A or B
A= ref $emailparts ne "ARRAY"B= length $emailparts->[1] == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 36 | require Sisimai::RFC1123; | |||||||||||||||||||||||||||||||||||||||||
| 49 | 36 | require Sisimai::SMTP::Command; | |||||||||||||||||||||||||||||||||||||||||
| 50 | 36 | my $dscontents = [__PACKAGE__->DELIVERYSTATUS]; my $v = undef; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 36 | my $readcursor = 0; # (Integer) Points the current cursor position | |||||||||||||||||||||||||||||||||||||||||
| 52 | 36 | my $recipients = 0; # (Integer) The number of 'Final-Recipient' header | |||||||||||||||||||||||||||||||||||||||||
| 53 | 36 | my $anotherone = {}; # (Ref->Hash) Another error information | |||||||||||||||||||||||||||||||||||||||||
| 54 | 36 | my $remotehost = ""; # (String) The last remote hostname | |||||||||||||||||||||||||||||||||||||||||
| 55 | 36 | my $curcommand = ""; # (String) The last SMTP command | |||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 36 | for my $e ( split("\n", $emailparts->[0]) ) { | |||||||||||||||||||||||||||||||||||||||||
| 58 | # Read error messages and delivery status lines from the head of the email to the previous | ||||||||||||||||||||||||||||||||||||||||||
| 59 | # line of the beginning of the original message. | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 262 | ▶ | unless( $readcursor ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | # Beginning of the bounce message or message/delivery-status part | ||||||||||||||||||||||||||||||||||||||||||
| 62 | 36 | ▶ | $readcursor |= $indicators->{'deliverystatus'} if index($e, $startingof->{'message'}->[0]) > -1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 36 | next; | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 226 | ▶ | next if ($readcursor & $indicators->{'deliverystatus'}) == 0 || $e eq ""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
($readcursor & $indicators->{"deliverystatus"}) == 0 or $e eq ""
MC/DC0%0/2
($readcursor & $indicators->{"deliverystatus"}) == 0 or $e eq ""
($readcursor & $indicators->{"deliverystatus"}) == 0
$e eq ""
Truth table33%1/3
A or B
A= ($readcursor & $indicators->{"deliverystatus"}) == 0B= $e eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | # ----- Transcript of session follows ----- | ||||||||||||||||||||||||||||||||||||||||||
| 68 | # While talking to smtp.example.com: | ||||||||||||||||||||||||||||||||||||||||||
| 69 | # >>> RCPT To:<kijitora@example.org> | ||||||||||||||||||||||||||||||||||||||||||
| 70 | # <<< 550 <kijitora@example.org>, User Unknown | ||||||||||||||||||||||||||||||||||||||||||
| 71 | # 550 <kijitora@example.org>... User unknown | ||||||||||||||||||||||||||||||||||||||||||
| 72 | # 421 example.org (smtp)... Deferred: Connection timed out during user open with example.org | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 226 | $v = $dscontents->[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 74 | 226 | ▶ | $curcommand = Sisimai::SMTP::Command->find(substr($e, 4,)) if index($e, ">>> ") == 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 226 | ▶ | if( Sisimai::String->aligned(\$e, [' <', '@', '>...']) || index(uc $e, ">>> RCPT TO:") > -1 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
"Sisimai::String"->aligned(\$e, [" <", "\@", ">..."]) or index(uc $e, ">>> RCPT TO:") != -1
MC/DC100%2/2
"Sisimai::String"->aligned(\$e, [" <", "\@", ">..."]) or index(uc $e, ">>> RCPT TO:") != -1
"Sisimai::String"->aligned(\$e, [" <", "\@", ">..."])
index(uc $e, ">>> RCPT TO:") != -1
Truth table100%3/3
A or B
A= "Sisimai::String"->aligned(\$e, [" <", "\@", ">..."])B= index(uc $e, ">>> RCPT TO:") != -1
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | # 550 <kijitora@example.org>... User unknown | ||||||||||||||||||||||||||||||||||||||||||
| 78 | # >>> RCPT To:<kijitora@example.org> | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 85 | my $p0 = index($e, " "); | |||||||||||||||||||||||||||||||||||||||||
| 80 | 85 | my $p1 = index($e, "<", $p0); | |||||||||||||||||||||||||||||||||||||||||
| 81 | 85 | my $p2 = index($e, ">", $p1); | |||||||||||||||||||||||||||||||||||||||||
| 82 | 85 | my $cv = Sisimai::Address->s3s4(substr($e, $p1, $p2 - $p1 + 1)); | |||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 85 | ▶ | if( $remotehost eq "" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | # Keep error messages before "While talking to ..." line | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 15 | $anotherone->{ $recipients } .= " ".$e; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 15 | next; | |||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | 70 | ▶ | if( $cv eq $v->{"recipient"} || ($curcommand eq "MAIL" && index($e, "<<< ") == 0) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$cv eq $v->{"recipient"} or $curcommand eq "MAIL" and index($e, "<<< ") == 0
$curcommand eq "MAIL" and index($e, "<<< ") == 0
MC/DC100%3/3
$cv eq $v->{"recipient"} or $curcommand eq "MAIL" and index($e, "<<< ") == 0
$cv eq $v->{"recipient"}
$curcommand eq "MAIL"
index($e, "<<< ") == 0
Truth table100%4/4
A or B and C
A= $cv eq $v->{"recipient"}B= $curcommand eq "MAIL"C= index($e, "<<< ") == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | # The recipient address is the same address with the last appeared address | ||||||||||||||||||||||||||||||||||||||||||
| 92 | # like "550 <mikeneko@example.co.jp>... User unknown" | ||||||||||||||||||||||||||||||||||||||||||
| 93 | # Append this line to the string which is keeping error messages | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 25 | $v->{"diagnosis"} .= " ".$e; | |||||||||||||||||||||||||||||||||||||||||
| 95 | 25 | $v->{"replycode"} = Sisimai::SMTP::Reply->find($e); | |||||||||||||||||||||||||||||||||||||||||
| 96 | 25 | $curcommand = ""; | |||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 99 | # The recipient address in this line differs from the last appeared address | ||||||||||||||||||||||||||||||||||||||||||
| 100 | # or is the first recipient address in this bounce message | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 45 | ▶ | if( $v->{'recipient'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | # There are multiple recipient addresses in the message body. | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 25 | push @$dscontents, __PACKAGE__->DELIVERYSTATUS; | |||||||||||||||||||||||||||||||||||||||||
| 104 | 25 | $v = $dscontents->[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 45 | $v->{"recipient"} = $cv; | |||||||||||||||||||||||||||||||||||||||||
| 107 | 45 | $v->{"rhost"} = $remotehost; | |||||||||||||||||||||||||||||||||||||||||
| 108 | 45 | $v->{"replycode"} = Sisimai::SMTP::Reply->find($e); | |||||||||||||||||||||||||||||||||||||||||
| 109 | 45 | $v->{"diagnosis"} .= " ".$e; | |||||||||||||||||||||||||||||||||||||||||
| 110 | 45 | ▶ | $v->{"command"} ||= $curcommand; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$v->{"command"} ||= $curcommand
MC/DC50%1/2
$v->{"command"} ||= $curcommand
$v->{"command"}
$curcommand
Truth table66%2/3
A ||= B
A= $v->{"command"}B= $curcommand
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 45 | $recipients++ | |||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||
| 113 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 114 | # This line does not include a recipient address | ||||||||||||||||||||||||||||||||||||||||||
| 115 | 141 | ▶ | if( index($e, $startingof->{"error"}->[0]) > -1 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | # ... while talking to mta.example.org.: | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 35 | my $cv = Sisimai::RFC1123->find($e); | |||||||||||||||||||||||||||||||||||||||||
| 118 | 35 | ▶ | $remotehost = $cv if Sisimai::RFC1123->is_internethost($cv); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 121 | # Append this line into the error message string | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 106 | ▶ | if( index($e, ">>> ") == 0 || index($e, "<<< ") == 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
index($e, ">>> ") == 0 or index($e, "<<< ") == 0
MC/DC100%2/2
index($e, ">>> ") == 0 or index($e, "<<< ") == 0
index($e, ">>> ") == 0
index($e, "<<< ") == 0
Truth table100%3/3
A or B
A= index($e, ">>> ") == 0B= index($e, "<<< ") == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | # >>> DATA | ||||||||||||||||||||||||||||||||||||||||||
| 124 | # <<< 550 Your E-Mail is redundant. You cannot send E-Mail to yourself (shironeko@example.jp). | ||||||||||||||||||||||||||||||||||||||||||
| 125 | # >>> QUIT | ||||||||||||||||||||||||||||||||||||||||||
| 126 | # <<< 421 dns.example.org Sorry, unable to contact destination SMTP daemon. | ||||||||||||||||||||||||||||||||||||||||||
| 127 | # <<< 550 Requested User Mailbox not found. No such user here. | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 45 | $v->{"diagnosis"} .= " ".$e | |||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 131 | # 421 Other error message | ||||||||||||||||||||||||||||||||||||||||||
| 132 | 61 | $anotherone->{ $recipients } .= " ".$e; | |||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 36 | ▶ | if( $recipients == 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | # There is no recipient address in the error message | ||||||||||||||||||||||||||||||||||||||||||
| 140 | 16 | for my $e ( keys %$anotherone ) { | |||||||||||||||||||||||||||||||||||||||||
| 141 | # Try to pick an recipient address, a reply code, and error messages | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 16 | ▶ | my $cv = Sisimai::Address->s3s4($anotherone->{ $e }); next unless Sisimai::Address->is_emailaddress($cv); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 10 | ▶ | my $cr = Sisimai::SMTP::Reply->find($anotherone->{ $e }) || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
'Sisimai::SMTP::Reply'->find($anotherone->{$e}) || ''
MC/DC0%0/1
'Sisimai::SMTP::Reply'->find($anotherone->{$e}) || ''
'Sisimai::SMTP::Reply'->find($anotherone->{$e})
Truth table50%1/2
A
A= 'Sisimai::SMTP::Reply'->find($anotherone->{$e})
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | 10 | $dscontents->[ $e ]->{"recipient"} = $cv; | |||||||||||||||||||||||||||||||||||||||||
| 146 | 10 | $dscontents->[ $e ]->{"replycode"} = $cr; | |||||||||||||||||||||||||||||||||||||||||
| 147 | 10 | $dscontents->[ $e ]->{"diagnosis"} = $anotherone->{ $e }; | |||||||||||||||||||||||||||||||||||||||||
| 148 | 10 | $recipients++; | |||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | 16 | ▶ | if( $recipients == 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | # Try to pick an recipient address from the original message | ||||||||||||||||||||||||||||||||||||||||||
| 153 | 6 | my $p1 = index($emailparts->[1], "\nTo: "); | |||||||||||||||||||||||||||||||||||||||||
| 154 | 6 | my $p2 = index($emailparts->[1], "\n", $p1 + 6); | |||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | 6 | ▶ | if( $p1 > 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | # Get the recipient address from "To:" header at the original message | ||||||||||||||||||||||||||||||||||||||||||
| 158 | 6 | my $cv = Sisimai::Address->s3s4(substr($emailparts->[1], $p1, $p2 - $p1 - 5)); | |||||||||||||||||||||||||||||||||||||||||
| 159 | 6 | ▶ | return undef unless Sisimai::Address->is_emailaddress($cv); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | $dscontents->[0]->{'recipient'} = $cv; | |||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | $recipients++; | |||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | 30 | ▶ | return undef unless $recipients; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 30 | my $j = 0; for my $e ( @$dscontents ) { | |||||||||||||||||||||||||||||||||||||||||
| 168 | # Tidy up the error message in e.Diagnosis | ||||||||||||||||||||||||||||||||||||||||||
| 169 | 55 | ▶ | $e->{"diagnosis"} ||= $anotherone->{ $j }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$e->{"diagnosis"} ||= $anotherone->{$j}
MC/DC0%0/2
$e->{"diagnosis"} ||= $anotherone->{$j}
$e->{"diagnosis"}
$anotherone->{$j}
Truth table33%1/3
A ||= B
A= $e->{"diagnosis"}B= $anotherone->{$j}
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | 55 | ▶ | $e->{"command"} ||= Sisimai::SMTP::Command->find($e->{"diagnosis"}); | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$e->{"command"} ||= "Sisimai::SMTP::Command"->find($e->{"diagnosis"})
MC/DC100%2/2
$e->{"command"} ||= "Sisimai::SMTP::Command"->find($e->{"diagnosis"})
$e->{"command"}
"Sisimai::SMTP::Command"->find($e->{"diagnosis"})
Truth table100%3/3
A ||= B
A= $e->{"command"}B= "Sisimai::SMTP::Command"->find($e->{"diagnosis"})
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | 55 | ▶ | $e->{'replycode'} = Sisimai::SMTP::Reply->find($e->{'diagnosis'}) || $anotherone->{'replycode'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
'Sisimai::SMTP::Reply'->find($e->{'diagnosis'}) || $anotherone->{'replycode'}
MC/DC0%0/2
'Sisimai::SMTP::Reply'->find($e->{'diagnosis'}) || $anotherone->{'replycode'}
'Sisimai::SMTP::Reply'->find($e->{'diagnosis'})
$anotherone->{'replycode'}
Truth table33%1/3
A || B
A= 'Sisimai::SMTP::Reply'->find($e->{'diagnosis'})B= $anotherone->{'replycode'}
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | # @example.jp, no local part | ||||||||||||||||||||||||||||||||||||||||||
| 174 | # Get email address from the value of Diagnostic-Code header | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 55 | ▶ | next if index($e->{'recipient'}, '@') > 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | my $p1 = index($e->{'diagnosis'}, '<'); next if $p1 == -1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | my $p2 = index($e->{'diagnosis'}, '>'); next if $p2 == -1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | $e->{'recipient'} = Sisimai::Address->s3s4(substr($e->{'diagnosis'}, $p1, $p2 - $p1)); | |||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||
| 180 | 30 | return {"ds" => $dscontents, "rfc822" => $emailparts->[1]}; | |||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 35 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 184 | __END__ | ||||||||||||||||||||||||||||||||||||||||||