| 1 | # Net::SMTP.pm | ||||||||||||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||||||||||||
| 3 | # Copyright (C) 1995-2004 Graham Barr. All rights reserved. | ||||||||||||||||||||||||||||||||||||||
| 4 | # Copyright (C) 2013-2016, 2020 Steve Hay. All rights reserved. | ||||||||||||||||||||||||||||||||||||||
| 5 | # This module is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||
| 6 | # the same terms as Perl itself, i.e. under the terms of either the GNU General | ||||||||||||||||||||||||||||||||||||||
| 7 | # Public License or the Artistic License, as specified in the F<LICENCE> file. | ||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||
| 9 | package Net::SMTP; | ||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||
| 11 | 6 | ▶ | use 5.008001; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||
| 13 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 14 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||
| 16 | 6 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 17 | 6 | ▶ | use IO::Socket; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 18 | 6 | ▶ | use Net::Cmd; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 19 | 6 | ▶ | use Net::Config; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 20 | 6 | ▶ | use Socket; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||
| 22 | 6 | our $VERSION = "3.16"; | |||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||
| 24 | # Code for detecting if we can use SSL | ||||||||||||||||||||||||||||||||||||||
| 25 | 6 | ▶ | my $ssl_class = eval { | ||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
eval {
do {
require IO::Socket::SSL;
BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
'IO::Socket::SSL'->VERSION(2.007)
}
} && 'IO::Socket::SSL'
MC/DC0%0/1
eval {
do {
require IO::Socket::SSL;
BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
'IO::Socket::SSL'->VERSION(2.007)
}
} && 'IO::Socket::SSL'
eval {
do {
require IO::Socket::SSL;
BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
'IO::Socket::SSL'->VERSION(2.007)
}
}
Truth table50%1/2
A
A= eval {
do {
require IO::Socket::SSL;
BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
'IO::Socket::SSL'->VERSION(2.007)
}
}
| |||||||||||||||||||||||||||||||||||||||
| 26 | 6 | require IO::Socket::SSL; | |||||||||||||||||||||||||||||||||||||
| 27 | # first version with default CA on most platforms | ||||||||||||||||||||||||||||||||||||||
| 28 | 6 | ▶ | no warnings 'numeric'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 29 | 6 | IO::Socket::SSL->VERSION(2.007); | |||||||||||||||||||||||||||||||||||||
| 30 | } && 'IO::Socket::SSL'; | ||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||
| 32 | 6 | ▶ | my $nossl_warn = !$ssl_class && | ||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
!$ssl_class && 'To use SSL please install IO::Socket::SSL with version>=2.007'
MC/DC0%0/1
!$ssl_class && 'To use SSL please install IO::Socket::SSL with version>=2.007'
!$ssl_class
Truth table50%1/2
not(A)
A= !$ssl_class
| |||||||||||||||||||||||||||||||||||||||
| 33 | 'To use SSL please install IO::Socket::SSL with version>=2.007'; | ||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||
| 35 | # Code for detecting if we can use IPv6 | ||||||||||||||||||||||||||||||||||||||
| 36 | 6 | my $family_key = 'Domain'; | |||||||||||||||||||||||||||||||||||||
| 37 | my $inet6_class = eval { | ||||||||||||||||||||||||||||||||||||||
| 38 | 6 | require IO::Socket::IP; | |||||||||||||||||||||||||||||||||||||
| 39 | 6 | ▶ | no warnings 'numeric'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 40 | 6 | ▶ | IO::Socket::IP->VERSION(0.25) || die; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 41 | 6 | ▶ | $family_key = 'Family'; | ||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
eval {
do {
use warnings;
require IO::Socket::INET6;
BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
"IO::Socket::INET6"->VERSION("2.62")
}
} and "IO::Socket::INET6"
MC/DC0%0/1
eval {
do {
use warnings;
require IO::Socket::INET6;
BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
"IO::Socket::INET6"->VERSION("2.62")
}
} and "IO::Socket::INET6"
eval {
do {
use warnings;
require IO::Socket::INET6;
BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
"IO::Socket::INET6"->VERSION("2.62")
}
}
Truth table0%0/2
A
A= eval {
do {
use warnings;
require IO::Socket::INET6;
BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
"IO::Socket::INET6"->VERSION("2.62")
}
}
| |||||||||||||||||||||||||||||||||||||||
| 42 | 6 | ▶ | } && 'IO::Socket::IP' || eval { | ||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
eval {
do {
require IO::Socket::IP;
BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
'IO::Socket::IP'->VERSION(0.25) or die;
$family_key = 'Family'
}
} && 'IO::Socket::IP' || eval {
do {
require IO::Socket::INET6;
BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
'IO::Socket::INET6'->VERSION(2.62)
}
} && 'IO::Socket::INET6'
eval {
do {
require IO::Socket::IP;
BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
"IO::Socket::IP"->VERSION("0.25") or die;
$family_key = "Family"
}
} and "IO::Socket::IP"
MC/DC0%0/2
eval {
do {
require IO::Socket::IP;
BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
'IO::Socket::IP'->VERSION(0.25) or die;
$family_key = 'Family'
}
} && 'IO::Socket::IP' || eval {
do {
require IO::Socket::INET6;
BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
'IO::Socket::INET6'->VERSION(2.62)
}
} && 'IO::Socket::INET6'
eval {
do {
require IO::Socket::IP;
BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
"IO::Socket::IP"->VERSION("0.25") or die;
$family_key = "Family"
}
}
eval {
do {
require IO::Socket::INET6;
BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
'IO::Socket::INET6'->VERSION(2.62)
}
} && 'IO::Socket::INET6'
Truth table33%1/3
A || B
A= eval {
do {
require IO::Socket::IP;
BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
"IO::Socket::IP"->VERSION("0.25") or die;
$family_key = "Family"
}
}B= eval {
do {
require IO::Socket::INET6;
BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"}
'IO::Socket::INET6'->VERSION(2.62)
}
} && 'IO::Socket::INET6'
| |||||||||||||||||||||||||||||||||||||||
| 43 | 0 | require IO::Socket::INET6; | |||||||||||||||||||||||||||||||||||||
| 44 | 6 | ▶ | no warnings 'numeric'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 45 | 0 | IO::Socket::INET6->VERSION(2.62); | |||||||||||||||||||||||||||||||||||||
| 46 | } && 'IO::Socket::INET6'; | ||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||
| 48 | 3 | ▶ | sub can_ssl { $ssl_class }; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
can_ssl: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 49 | 1 | ▶ | sub can_inet6 { $inet6_class }; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
can_inet6: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||
| 51 | 6 | ▶ | our @ISA = ('Net::Cmd', $inet6_class || 'IO::Socket::INET'); | ||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$inet6_class || 'IO::Socket::INET'
MC/DC0%0/1
$inet6_class || 'IO::Socket::INET'
$inet6_class
Truth table50%1/2
A
A= $inet6_class
| |||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||
| 53 | 3 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=22 SCAR=37.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 54 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 55 | 3 | ▶ | my $type = ref($self) || $self; | ||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table33%1/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||||||||||||||||||||
| 56 | 3 | my ($host, %arg); | |||||||||||||||||||||||||||||||||||||
| 57 | 3 | ▶ | if (@_ % 2) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 58 | 3 | $host = shift; | |||||||||||||||||||||||||||||||||||||
| 59 | 3 | %arg = @_; | |||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||
| 61 | else { | ||||||||||||||||||||||||||||||||||||||
| 62 | 0 | %arg = @_; | |||||||||||||||||||||||||||||||||||||
| 63 | 0 | $host = delete $arg{Host}; | |||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||
| 66 | 3 | ▶ | if ($arg{SSL}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 67 | # SSL from start | ||||||||||||||||||||||||||||||||||||||
| 68 | 2 | ▶ | die $nossl_warn if !$ssl_class; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 69 | 2 | ▶ | $arg{Port} ||= 465; | ||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$arg{"Port"} ||= 465
MC/DC0%0/1
$arg{"Port"} ||= 465
$arg{"Port"}
Truth table50%1/2
A
A= $arg{"Port"}
| |||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||
| 72 | 3 | ▶ | my $hosts = defined $host ? $host : $NetConfig{smtp_hosts}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 73 | 3 | my $obj; | |||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||
| 75 | 3 | ▶ | $arg{Timeout} = 120 if ! defined $arg{Timeout}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||
| 77 | 3 | ▶ | foreach my $h (@{ref($hosts) ? $hosts : [$hosts]}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 78 | $obj = $type->SUPER::new( | ||||||||||||||||||||||||||||||||||||||
| 79 | PeerAddr => ($host = $h), | ||||||||||||||||||||||||||||||||||||||
| 80 | PeerPort => $arg{Port} || 'smtp(25)', | ||||||||||||||||||||||||||||||||||||||
| 81 | LocalAddr => $arg{LocalAddr}, | ||||||||||||||||||||||||||||||||||||||
| 82 | LocalPort => $arg{LocalPort}, | ||||||||||||||||||||||||||||||||||||||
| 83 | $family_key => $arg{Domain} || $arg{Family}, | ||||||||||||||||||||||||||||||||||||||
| 84 | Proto => 'tcp', | ||||||||||||||||||||||||||||||||||||||
| 85 | Timeout => $arg{Timeout} | ||||||||||||||||||||||||||||||||||||||
| 86 | ) | ||||||||||||||||||||||||||||||||||||||
| 87 | 3 | ▶ | and last; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
$arg{'Port'} || 'smtp(25)'
$arg{'Domain'} || $arg{'Family'}
MC/DC100%1/1
$arg{'Port'} || 'smtp(25)'
$arg{'Port'}
MC/DC0%0/2
$arg{'Domain'} || $arg{'Family'}
$arg{'Domain'}
$arg{'Family'}
Truth table100%2/2
A
A= $arg{'Port'}
Truth table33%1/3
A || B
A= $arg{'Domain'}B= $arg{'Family'}
| |||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||
| 90 | return | ||||||||||||||||||||||||||||||||||||||
| 91 | 3 | ▶ | unless defined $obj; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||
| 93 | 3 | ${*$obj}{'net_smtp_arg'} = \%arg; | |||||||||||||||||||||||||||||||||||||
| 94 | 3 | ${*$obj}{'net_smtp_host'} = $host; | |||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||
| 96 | 3 | ▶ | if ($arg{SSL}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 97 | 2 | ▶ | Net::SMTP::_SSL->start_SSL($obj,%arg) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 98 | or return; | ||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||
| 101 | 3 | $obj->autoflush(1); | |||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||
| 103 | 3 | ▶ | $obj->debug(exists $arg{Debug} ? $arg{Debug} : undef); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||
| 105 | 3 | ▶ | unless ($obj->response() == CMD_OK) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 106 | 0 | my $err = ref($obj) . ": " . $obj->code . " " . $obj->message; | |||||||||||||||||||||||||||||||||||||
| 107 | 0 | $obj->close(); | |||||||||||||||||||||||||||||||||||||
| 108 | 0 | $@ = $err; | |||||||||||||||||||||||||||||||||||||
| 109 | 0 | return; | |||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||
| 112 | 3 | ${*$obj}{'net_smtp_exact_addr'} = $arg{ExactAddresses}; | |||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||
| 114 | 3 | (${*$obj}{'net_smtp_banner'}) = $obj->message; | |||||||||||||||||||||||||||||||||||||
| 115 | 3 | (${*$obj}{'net_smtp_domain'}) = $obj->message =~ /\A\s*(\S+)/; | |||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||
| 117 | 3 | ▶ | if (!exists $arg{SendHello} || $arg{SendHello}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not exists $arg{"SendHello"} or $arg{"SendHello"}
MC/DC0%0/2
not exists $arg{"SendHello"} or $arg{"SendHello"}
not exists $arg{"SendHello"}
$arg{"SendHello"}
Truth table33%1/3
not(A) or B
A= not exists $arg{"SendHello"}B= $arg{"SendHello"}
| |||||||||||||||||||||||||||||||||||||||
| 118 | 3 | ▶ | unless ($obj->hello($arg{Hello} || "")) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$arg{'Hello'} || ''
MC/DC0%0/1
$arg{'Hello'} || ''
$arg{'Hello'}
Truth table50%1/2
A
A= $arg{'Hello'}
| |||||||||||||||||||||||||||||||||||||||
| 119 | 0 | my $err = ref($obj) . ": " . $obj->code . " " . $obj->message; | |||||||||||||||||||||||||||||||||||||
| 120 | 0 | $obj->close(); | |||||||||||||||||||||||||||||||||||||
| 121 | 0 | $@ = $err; | |||||||||||||||||||||||||||||||||||||
| 122 | 0 | return; | |||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||
| 126 | 3 | $obj; | |||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | sub host { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
host: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 131 | 0 | my $me = shift; | |||||||||||||||||||||||||||||||||||||
| 132 | 0 | ${*$me}{'net_smtp_host'}; | |||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||
| 135 | ## | ||||||||||||||||||||||||||||||||||||||
| 136 | ## User interface methods | ||||||||||||||||||||||||||||||||||||||
| 137 | ## | ||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | sub banner { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
banner: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 141 | 0 | my $me = shift; | |||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | return ${*$me}{'net_smtp_banner'} || undef; | ||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
do {
*$me
}->{'net_smtp_banner'} || undef
MC/DC0%0/1
do {
*$me
}->{'net_smtp_banner'} || undef
do {
*$me
}->{'net_smtp_banner'}
Truth table0%0/2
A
A= do {
*$me
}->{'net_smtp_banner'}
| |||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | sub domain { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
domain: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 148 | 0 | my $me = shift; | |||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | return ${*$me}{'net_smtp_domain'} || undef; | ||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
do {
*$me
}->{'net_smtp_domain'} || undef
MC/DC0%0/1
do {
*$me
}->{'net_smtp_domain'} || undef
do {
*$me
}->{'net_smtp_domain'}
Truth table0%0/2
A
A= do {
*$me
}->{'net_smtp_domain'}
| |||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | sub etrn { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
etrn: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | defined($self->supports('ETRN', 500, ["Command unknown: 'ETRN'"])) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 157 | && $self->_ETRN(@_); | ||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | sub auth { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
auth: not called CC=18 SCAR=58.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 162 | 0 | my ($self, $username, $password) = @_; | |||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | eval { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 165 | 0 | require MIME::Base64; | |||||||||||||||||||||||||||||||||||||
| 166 | 0 | require Authen::SASL; | |||||||||||||||||||||||||||||||||||||
| 167 | } or $self->set_status(500, ["Need MIME::Base64 and Authen::SASL todo auth"]), return 0; | ||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||
| 169 | 0 | my $mechanisms = $self->supports('AUTH', 500, ["Command unknown: 'AUTH'"]); | |||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | return unless defined $mechanisms; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||
| 172 | 0 | my $sasl; | |||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | if (ref($username) and UNIVERSAL::isa($username, 'Authen::SASL')) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $username and UNIVERSAL::isa($username, "Authen::SASL")
MC/DC0%0/2
ref $username and UNIVERSAL::isa($username, "Authen::SASL")
ref $username
UNIVERSAL::isa($username, "Authen::SASL")
Truth table0%0/3
A and B
A= ref $usernameB= UNIVERSAL::isa($username, "Authen::SASL")
| |||||||||||||||||||||||||||||||||||||||
| 175 | 0 | $sasl = $username; | |||||||||||||||||||||||||||||||||||||
| 176 | 0 | my $requested_mechanisms = $sasl->mechanism(); | |||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | if (! defined($requested_mechanisms) || $requested_mechanisms eq '') { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $requested_mechanisms or $requested_mechanisms eq ""
MC/DC0%0/2
not defined $requested_mechanisms or $requested_mechanisms eq ""
not defined $requested_mechanisms
$requested_mechanisms eq ""
Truth table0%0/3
not(A) or B
A= not defined $requested_mechanismsB= $requested_mechanisms eq ""
| |||||||||||||||||||||||||||||||||||||||
| 178 | 0 | $sasl->mechanism($mechanisms); | |||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||
| 181 | else { | ||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | die "auth(username, password)" if not length $username; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 183 | 0 | $sasl = Authen::SASL->new( | |||||||||||||||||||||||||||||||||||||
| 184 | mechanism => $mechanisms, | ||||||||||||||||||||||||||||||||||||||
| 185 | callback => { | ||||||||||||||||||||||||||||||||||||||
| 186 | user => $username, | ||||||||||||||||||||||||||||||||||||||
| 187 | pass => $password, | ||||||||||||||||||||||||||||||||||||||
| 188 | authname => $username, | ||||||||||||||||||||||||||||||||||||||
| 189 | }, | ||||||||||||||||||||||||||||||||||||||
| 190 | debug => $self->debug | ||||||||||||||||||||||||||||||||||||||
| 191 | ); | ||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my $client; | |||||||||||||||||||||||||||||||||||||
| 195 | my $str; | ||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | do { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | if ($client) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 198 | # $client mechanism failed, so we need to exclude this mechanism from list | ||||||||||||||||||||||||||||||||||||||
| 199 | 0 | my $failed_mechanism = $client->mechanism; | |||||||||||||||||||||||||||||||||||||
| 200 | 0 | ▶ | return unless defined $failed_mechanism; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | $self->debug_text("Auth mechanism failed: $failed_mechanism") | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 202 | if $self->debug; | ||||||||||||||||||||||||||||||||||||||
| 203 | 0 | $mechanisms =~ s/\b\Q$failed_mechanism\E\b//; | |||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | return unless $mechanisms =~ /\S/; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 205 | 0 | $sasl->mechanism($mechanisms); | |||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||
| 208 | # We should probably allow the user to pass the host, but I don't | ||||||||||||||||||||||||||||||||||||||
| 209 | # currently know and SASL mechanisms that are used by smtp that need it | ||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||
| 211 | 0 | $client = $sasl->client_new('smtp', ${*$self}{'net_smtp_host'}, 0); | |||||||||||||||||||||||||||||||||||||
| 212 | 0 | $str = $client->client_start; | |||||||||||||||||||||||||||||||||||||
| 213 | } while (!defined $str); | ||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||
| 215 | # We don't support sasl mechanisms that encrypt the socket traffic. | ||||||||||||||||||||||||||||||||||||||
| 216 | # todo that we would really need to change the ISA hierarchy | ||||||||||||||||||||||||||||||||||||||
| 217 | # so we don't inherit from IO::Socket, but instead hold it in an attribute | ||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||
| 219 | 0 | my @cmd = ("AUTH", $client->mechanism); | |||||||||||||||||||||||||||||||||||||
| 220 | 0 | my $code; | |||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | push @cmd, MIME::Base64::encode_base64($str, '') | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $str and length $str
MC/DC0%0/2
defined $str and length $str
defined $str
length $str
Truth table0%0/3
A and B
A= defined $strB= length $str
| |||||||||||||||||||||||||||||||||||||||
| 223 | if defined $str and length $str; | ||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | while (($code = $self->command(@cmd)->response()) == CMD_MORE) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 226 | 0 | my $str2 = MIME::Base64::decode_base64(($self->message)[0]); | |||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | $self->debug_print(0, "(decoded) " . $str2 . "\n") if $self->debug; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||
| 229 | 0 | $str = $client->client_step($str2); | |||||||||||||||||||||||||||||||||||||
| 230 | 0 | @cmd = ( | |||||||||||||||||||||||||||||||||||||
| 231 | MIME::Base64::encode_base64($str, '') | ||||||||||||||||||||||||||||||||||||||
| 232 | ); | ||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | $self->debug_print(1, "(decoded) " . $str . "\n") if $self->debug; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $code == CMD_OK; | |||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||
| 241 | 4 | ▶ | sub hello { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
hello: called CC=9 SCAR=24.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 242 | 4 | my $me = shift; | |||||||||||||||||||||||||||||||||||||
| 243 | 4 | ▶ | my $domain = shift || "localhost.localdomain"; | ||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || 'localhost.localdomain'
MC/DC100%1/1
shift() || 'localhost.localdomain'
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||
| 244 | 4 | my $ok = $me->_EHLO($domain); | |||||||||||||||||||||||||||||||||||||
| 245 | 4 | my @msg = $me->message; | |||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||
| 247 | 4 | ▶ | if ($ok) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 248 | 4 | my $h = ${*$me}{'net_smtp_esmtp'} = {}; | |||||||||||||||||||||||||||||||||||||
| 249 | 4 | foreach my $ln (@msg) { | |||||||||||||||||||||||||||||||||||||
| 250 | 9 | ▶ | $h->{uc $1} = $2 | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 251 | if $ln =~ /([-\w]+)\b[= \t]*([^\n]*)/; | ||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||
| 254 | elsif ($me->status == CMD_ERROR) { | ||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | @msg = $me->message | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 256 | if $ok = $me->_HELO($domain); | ||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||
| 259 | 4 | ▶ | return unless $ok; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 260 | 4 | ${*$me}{net_smtp_hello_domain} = $domain; | |||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||
| 262 | 4 | $msg[0] =~ /\A\s*(\S+)/; | |||||||||||||||||||||||||||||||||||||
| 263 | 4 | ▶ | return ($1 || " "); | ||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$1 || ' '
MC/DC0%0/1
$1 || ' '
$1
Truth table50%1/2
A
A= $1
| |||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||
| 266 | 1 | ▶ | sub starttls { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
starttls: called CC=4 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 267 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 268 | 1 | ▶ | $ssl_class or die $nossl_warn; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 269 | 1 | ▶ | $self->_STARTTLS or return; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 270 | Net::SMTP::_SSL->start_SSL($self, | ||||||||||||||||||||||||||||||||||||||
| 271 | 1 | ▶ | %{ ${*$self}{'net_smtp_arg'} }, # (ssl) args given in new | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 272 | @_ # more (ssl) args | ||||||||||||||||||||||||||||||||||||||
| 273 | ) or return; | ||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||
| 275 | # another hello after starttls to read new ESMTP capabilities | ||||||||||||||||||||||||||||||||||||||
| 276 | 1 | return $self->hello(${*$self}{net_smtp_hello_domain}); | |||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | sub supports { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
supports: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 281 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 282 | 0 | my $cmd = uc shift; | |||||||||||||||||||||||||||||||||||||
| 283 | 0 | return ${*$self}{'net_smtp_esmtp'}->{$cmd} | |||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | if exists ${*$self}{'net_smtp_esmtp'}->{$cmd}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | $self->set_status(@_) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 286 | if @_; | ||||||||||||||||||||||||||||||||||||||
| 287 | 0 | return; | |||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | sub _addr { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_addr: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||
| 292 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 293 | 0 | my $addr = shift; | |||||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | $addr = "" unless defined $addr; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | if (${*$self}{'net_smtp_exact_addr'}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | return $1 if $addr =~ /^\s*(<.*>)\s*$/s; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||
| 299 | else { | ||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | return $1 if $addr =~ /(<[^>]*>)/; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 301 | 0 | $addr =~ s/^\s+|\s+$//sg; | |||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||
| 304 | 0 | "<$addr>"; | |||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||
| 308 | 0 | ▶ | sub mail { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
mail: not called CC=29 SCAR=67.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 309 | 0 | my $me = shift; | |||||||||||||||||||||||||||||||||||||
| 310 | 0 | my $addr = _addr($me, shift); | |||||||||||||||||||||||||||||||||||||
| 311 | 0 | my $opts = ""; | |||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 314 | 0 | my %opt = @_; | |||||||||||||||||||||||||||||||||||||
| 315 | 0 | my ($k, $v); | |||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | if (exists ${*$me}{'net_smtp_esmtp'}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 318 | 0 | my $esmtp = ${*$me}{'net_smtp_esmtp'}; | |||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | if (defined($v = delete $opt{Size})) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | if (exists $esmtp->{SIZE}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 322 | 0 | $opts .= sprintf " SIZE=%d", $v + 0; | |||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||
| 324 | else { | ||||||||||||||||||||||||||||||||||||||
| 325 | 0 | carp 'Net::SMTP::mail: SIZE option not supported by host'; | |||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | if (defined($v = delete $opt{Return})) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | if (exists $esmtp->{DSN}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | $opts .= " RET=" . ((uc($v) eq "FULL") ? "FULL" : "HDRS"); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||
| 333 | else { | ||||||||||||||||||||||||||||||||||||||
| 334 | 0 | carp 'Net::SMTP::mail: DSN option not supported by host'; | |||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | if (defined($v = delete $opt{Bits})) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | if ($v eq "8") { | ||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||
| 340 | 0 | ▶ | if (exists $esmtp->{'8BITMIME'}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 341 | 0 | $opts .= " BODY=8BITMIME"; | |||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||
| 343 | else { | ||||||||||||||||||||||||||||||||||||||
| 344 | 0 | carp 'Net::SMTP::mail: 8BITMIME option not supported by host'; | |||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||
| 347 | elsif ($v eq "binary") { | ||||||||||||||||||||||||||||||||||||||
| 348 | 0 | ▶ | if (exists $esmtp->{'BINARYMIME'} && exists $esmtp->{'CHUNKING'}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $esmtp->{"BINARYMIME"} and exists $esmtp->{"CHUNKING"}
MC/DC0%0/2
exists $esmtp->{"BINARYMIME"} and exists $esmtp->{"CHUNKING"}
exists $esmtp->{"BINARYMIME"}
exists $esmtp->{"CHUNKING"}
Truth table0%0/3
A and B
A= exists $esmtp->{"BINARYMIME"}B= exists $esmtp->{"CHUNKING"}
| |||||||||||||||||||||||||||||||||||||||
| 349 | 0 | $opts .= " BODY=BINARYMIME"; | |||||||||||||||||||||||||||||||||||||
| 350 | 0 | ${*$me}{'net_smtp_chunking'} = 1; | |||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||
| 352 | else { | ||||||||||||||||||||||||||||||||||||||
| 353 | 0 | carp 'Net::SMTP::mail: BINARYMIME option not supported by host'; | |||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||
| 356 | ▶ | elsif (exists $esmtp->{'8BITMIME'} or exists $esmtp->{'BINARYMIME'}) { | |||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
exists $esmtp->{"8BITMIME"} or exists $esmtp->{"BINARYMIME"}
MC/DC0%0/2
exists $esmtp->{"8BITMIME"} or exists $esmtp->{"BINARYMIME"}
exists $esmtp->{"8BITMIME"}
exists $esmtp->{"BINARYMIME"}
Truth table0%0/3
A or B
A= exists $esmtp->{"8BITMIME"}B= exists $esmtp->{"BINARYMIME"}
| |||||||||||||||||||||||||||||||||||||||
| 357 | 0 | $opts .= " BODY=7BIT"; | |||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||
| 359 | else { | ||||||||||||||||||||||||||||||||||||||
| 360 | 0 | carp 'Net::SMTP::mail: 8BITMIME and BINARYMIME options not supported by host'; | |||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | if (defined($v = delete $opt{Transaction})) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 365 | 0 | ▶ | if (exists $esmtp->{CHECKPOINT}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 366 | 0 | $opts .= " TRANSID=" . _addr($me, $v); | |||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||
| 368 | else { | ||||||||||||||||||||||||||||||||||||||
| 369 | 0 | carp 'Net::SMTP::mail: CHECKPOINT option not supported by host'; | |||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||
| 373 | 0 | ▶ | if (defined($v = delete $opt{Envelope})) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 374 | 0 | ▶ | if (exists $esmtp->{DSN}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 375 | 0 | $v =~ s/([^\041-\176]|=|\+)/sprintf "+%02X", ord($1)/sge; | |||||||||||||||||||||||||||||||||||||
| 376 | 0 | $opts .= " ENVID=$v"; | |||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||
| 378 | else { | ||||||||||||||||||||||||||||||||||||||
| 379 | 0 | carp 'Net::SMTP::mail: DSN option not supported by host'; | |||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | if (defined($v = delete $opt{ENVID})) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||
| 385 | # expected to be in a format as required by RFC 3461, xtext-encoded | ||||||||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | if (exists $esmtp->{DSN}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 387 | 0 | $opts .= " ENVID=$v"; | |||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||
| 389 | else { | ||||||||||||||||||||||||||||||||||||||
| 390 | 0 | carp 'Net::SMTP::mail: DSN option not supported by host'; | |||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | if (defined($v = delete $opt{AUTH})) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||
| 396 | # expected to be in a format as required by RFC 2554, | ||||||||||||||||||||||||||||||||||||||
| 397 | # rfc2821-quoted and xtext-encoded, or <> | ||||||||||||||||||||||||||||||||||||||
| 398 | 0 | ▶ | if (exists $esmtp->{AUTH}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | $v = '<>' if !defined($v) || $v eq ''; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $v or $v eq ""
MC/DC0%0/2
not defined $v or $v eq ""
not defined $v
$v eq ""
Truth table0%0/3
not(A) or B
A= not defined $vB= $v eq ""
| |||||||||||||||||||||||||||||||||||||||
| 400 | 0 | $opts .= " AUTH=$v"; | |||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||
| 402 | else { | ||||||||||||||||||||||||||||||||||||||
| 403 | 0 | carp 'Net::SMTP::mail: AUTH option not supported by host'; | |||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||
| 407 | 0 | ▶ | if (defined($v = delete $opt{XVERP})) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 408 | 0 | ▶ | if (exists $esmtp->{'XVERP'}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 409 | 0 | $opts .= " XVERP"; | |||||||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||||||||
| 411 | else { | ||||||||||||||||||||||||||||||||||||||
| 412 | 0 | carp 'Net::SMTP::mail: XVERP option not supported by host'; | |||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||
| 416 | 0 | ▶ | carp 'Net::SMTP::recipient: unknown option(s) ' . join(" ", keys %opt) . ' - ignored' | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 417 | if scalar keys %opt; | ||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||
| 419 | else { | ||||||||||||||||||||||||||||||||||||||
| 420 | 0 | carp 'Net::SMTP::mail: ESMTP not supported by host - options discarded :-('; | |||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||
| 424 | 0 | $me->_MAIL("FROM:" . $addr . $opts); | |||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||
| 428 | 0 | ▶ | sub send { my $me = shift; $me->_SEND("FROM:" . _addr($me, $_[0])) } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
send: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 429 | 0 | ▶ | sub send_or_mail { my $me = shift; $me->_SOML("FROM:" . _addr($me, $_[0])) } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
send_or_mail: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 430 | 0 | ▶ | sub send_and_mail { my $me = shift; $me->_SAML("FROM:" . _addr($me, $_[0])) } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
send_and_mail: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | sub reset { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 434 | 0 | my $me = shift; | |||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||
| 436 | $me->dataend() | ||||||||||||||||||||||||||||||||||||||
| 437 | 0 | ▶ | if (exists ${*$me}{'net_smtp_lastch'}); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||
| 439 | 0 | $me->_RSET(); | |||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||
| 443 | 0 | ▶ | sub recipient { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
recipient: not called CC=15 SCAR=54.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 444 | 0 | my $smtp = shift; | |||||||||||||||||||||||||||||||||||||
| 445 | 0 | my $opts = ""; | |||||||||||||||||||||||||||||||||||||
| 446 | 0 | my $skip_bad = 0; | |||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||
| 448 | 0 | ▶ | if (@_ && ref($_[-1])) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ and ref $_[-1]
MC/DC0%0/2
@_ and ref $_[-1]
@_
ref $_[-1]
Truth table0%0/3
A and B
A= @_B= ref $_[-1]
| |||||||||||||||||||||||||||||||||||||||
| 449 | 0 | my %opt = %{pop(@_)}; | |||||||||||||||||||||||||||||||||||||
| 450 | 0 | my $v; | |||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||
| 452 | 0 | $skip_bad = delete $opt{'SkipBad'}; | |||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||
| 454 | 0 | ▶ | if (exists ${*$smtp}{'net_smtp_esmtp'}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 455 | 0 | my $esmtp = ${*$smtp}{'net_smtp_esmtp'}; | |||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||
| 457 | 0 | ▶ | if (defined($v = delete $opt{Notify})) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 458 | 0 | ▶ | if (exists $esmtp->{DSN}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 459 | 0 | $opts .= " NOTIFY=" . join(",", map { uc $_ } @$v); | |||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||
| 461 | else { | ||||||||||||||||||||||||||||||||||||||
| 462 | 0 | carp 'Net::SMTP::recipient: DSN option not supported by host'; | |||||||||||||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||
| 466 | 0 | ▶ | if (defined($v = delete $opt{ORcpt})) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 467 | 0 | ▶ | if (exists $esmtp->{DSN}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 468 | 0 | $opts .= " ORCPT=" . $v; | |||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||
| 470 | else { | ||||||||||||||||||||||||||||||||||||||
| 471 | 0 | carp 'Net::SMTP::recipient: DSN option not supported by host'; | |||||||||||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||
| 475 | 0 | ▶ | carp 'Net::SMTP::recipient: unknown option(s) ' . join(" ", keys %opt) . ' - ignored' | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 476 | if scalar keys %opt; | ||||||||||||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||||||||||||
| 478 | elsif (%opt) { | ||||||||||||||||||||||||||||||||||||||
| 479 | 0 | carp 'Net::SMTP::recipient: ESMTP not supported by host - options discarded :-('; | |||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||
| 483 | 0 | my @ok; | |||||||||||||||||||||||||||||||||||||
| 484 | 0 | foreach my $addr (@_) { | |||||||||||||||||||||||||||||||||||||
| 485 | 0 | ▶ | if ($smtp->_RCPT("TO:" . _addr($smtp, $addr) . $opts)) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 486 | 0 | ▶ | push(@ok, $addr) if $skip_bad; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||
| 488 | elsif (!$skip_bad) { | ||||||||||||||||||||||||||||||||||||||
| 489 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||
| 493 | 0 | ▶ | return $skip_bad ? @ok : 1; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||
| 496 | 6 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 497 | 6 | *to = \&recipient; | |||||||||||||||||||||||||||||||||||||
| 498 | 6 | *cc = \&recipient; | |||||||||||||||||||||||||||||||||||||
| 499 | 6 | *bcc = \&recipient; | |||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||
| 503 | 0 | ▶ | sub data { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
data: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 504 | 0 | my $me = shift; | |||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||
| 506 | 0 | ▶ | if (exists ${*$me}{'net_smtp_chunking'}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 507 | 0 | carp 'Net::SMTP::data: CHUNKING extension in use, must call bdat instead'; | |||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||
| 509 | else { | ||||||||||||||||||||||||||||||||||||||
| 510 | 0 | ▶ | my $ok = $me->_DATA() && $me->datasend(@_); | ||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$me->_DATA && $me->datasend(@_)
MC/DC0%0/2
$me->_DATA && $me->datasend(@_)
$me->_DATA
$me->datasend(@_)
Truth table0%0/3
A && B
A= $me->_DATAB= $me->datasend(@_)
| |||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||
| 512 | 0 | ▶ | $ok && @_ | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ok and @_
MC/DC0%0/2
$ok and @_
$ok
@_
Truth table0%0/3
A and B
A= $okB= @_
| |||||||||||||||||||||||||||||||||||||||
| 513 | ? $me->dataend | ||||||||||||||||||||||||||||||||||||||
| 514 | : $ok; | ||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||
| 519 | 0 | ▶ | sub bdat { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
bdat: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 520 | 0 | my $me = shift; | |||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||
| 522 | 0 | ▶ | if (exists ${*$me}{'net_smtp_chunking'}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 523 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||
| 525 | 0 | ▶ | $me->_BDAT(length $data) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$me->_BDAT(length $data) and $me->rawdatasend($data)
MC/DC0%0/2
$me->_BDAT(length $data) and $me->rawdatasend($data)
$me->_BDAT(length $data)
$me->rawdatasend($data)
Truth table0%0/3
A and B
A= $me->_BDAT(length $data)B= $me->rawdatasend($data)
| |||||||||||||||||||||||||||||||||||||||
| 526 | && $me->rawdatasend($data) | ||||||||||||||||||||||||||||||||||||||
| 527 | && $me->response() == CMD_OK; | ||||||||||||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||||||||||
| 529 | else { | ||||||||||||||||||||||||||||||||||||||
| 530 | 0 | carp 'Net::SMTP::bdat: CHUNKING extension is not in use, call data instead'; | |||||||||||||||||||||||||||||||||||||
| 531 | } | ||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | sub bdatlast { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
bdatlast: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 536 | 0 | my $me = shift; | |||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||
| 538 | 0 | ▶ | if (exists ${*$me}{'net_smtp_chunking'}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 539 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||
| 541 | 0 | ▶ | $me->_BDAT(length $data, "LAST") | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$me->_BDAT(length $data, "LAST") and $me->rawdatasend($data)
MC/DC0%0/2
$me->_BDAT(length $data, "LAST") and $me->rawdatasend($data)
$me->_BDAT(length $data, "LAST")
$me->rawdatasend($data)
Truth table0%0/3
A and B
A= $me->_BDAT(length $data, "LAST")B= $me->rawdatasend($data)
| |||||||||||||||||||||||||||||||||||||||
| 542 | && $me->rawdatasend($data) | ||||||||||||||||||||||||||||||||||||||
| 543 | && $me->response() == CMD_OK; | ||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||
| 545 | else { | ||||||||||||||||||||||||||||||||||||||
| 546 | 0 | carp 'Net::SMTP::bdat: CHUNKING extension is not in use, call data instead'; | |||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||
| 551 | 0 | ▶ | sub datafh { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
datafh: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 552 | 0 | my $me = shift; | |||||||||||||||||||||||||||||||||||||
| 553 | 0 | ▶ | return unless $me->_DATA(); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 554 | 0 | return $me->tied_fh; | |||||||||||||||||||||||||||||||||||||
| 555 | } | ||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | sub expand { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
expand: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 559 | 0 | my $me = shift; | |||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||
| 561 | 0 | ▶ | $me->_EXPN(@_) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 562 | ? ($me->message) | ||||||||||||||||||||||||||||||||||||||
| 563 | : (); | ||||||||||||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||
| 567 | 0 | ▶ | sub verify { shift->_VRFY(@_) } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
verify: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||
| 570 | 0 | ▶ | sub help { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
help: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 571 | 0 | my $me = shift; | |||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||
| 573 | 0 | ▶ | $me->_HELP(@_) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 574 | ? scalar $me->message | ||||||||||||||||||||||||||||||||||||||
| 575 | : undef; | ||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||
| 579 | 3 | ▶ | sub quit { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
quit: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 580 | 3 | my $me = shift; | |||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||
| 582 | 3 | $me->_QUIT; | |||||||||||||||||||||||||||||||||||||
| 583 | 3 | $me->close; | |||||||||||||||||||||||||||||||||||||
| 584 | } | ||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||
| 587 | 0 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||
| 589 | # ignore | ||||||||||||||||||||||||||||||||||||||
| 590 | } | ||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||
| 592 | ## | ||||||||||||||||||||||||||||||||||||||
| 593 | ## RFC821 commands | ||||||||||||||||||||||||||||||||||||||
| 594 | ## | ||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||
| 597 | 4 | ▶ | sub _EHLO { shift->command("EHLO", @_)->response() == CMD_OK } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_EHLO: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 598 | 0 | ▶ | sub _HELO { shift->command("HELO", @_)->response() == CMD_OK } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_HELO: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 599 | 0 | ▶ | sub _MAIL { shift->command("MAIL", @_)->response() == CMD_OK } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_MAIL: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 600 | 0 | ▶ | sub _RCPT { shift->command("RCPT", @_)->response() == CMD_OK } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_RCPT: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 601 | 0 | ▶ | sub _SEND { shift->command("SEND", @_)->response() == CMD_OK } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_SEND: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 602 | 0 | ▶ | sub _SAML { shift->command("SAML", @_)->response() == CMD_OK } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_SAML: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 603 | 0 | ▶ | sub _SOML { shift->command("SOML", @_)->response() == CMD_OK } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_SOML: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 604 | 0 | ▶ | sub _VRFY { shift->command("VRFY", @_)->response() == CMD_OK } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_VRFY: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 605 | 0 | ▶ | sub _EXPN { shift->command("EXPN", @_)->response() == CMD_OK } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_EXPN: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 606 | 0 | ▶ | sub _HELP { shift->command("HELP", @_)->response() == CMD_OK } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_HELP: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 607 | 0 | ▶ | sub _RSET { shift->command("RSET")->response() == CMD_OK } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_RSET: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 608 | 0 | ▶ | sub _NOOP { shift->command("NOOP")->response() == CMD_OK } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_NOOP: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 609 | 3 | ▶ | sub _QUIT { shift->command("QUIT")->response() == CMD_OK } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_QUIT: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 610 | 0 | ▶ | sub _DATA { shift->command("DATA")->response() == CMD_MORE } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_DATA: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 611 | 0 | ▶ | sub _BDAT { shift->command("BDAT", @_) } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_BDAT: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 612 | 0 | ▶ | sub _TURN { shift->unsupported(@_); } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_TURN: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 613 | 0 | ▶ | sub _ETRN { shift->command("ETRN", @_)->response() == CMD_OK } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_ETRN: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 614 | 0 | ▶ | sub _AUTH { shift->command("AUTH", @_)->response() == CMD_OK } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_AUTH: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 615 | 1 | ▶ | sub _STARTTLS { shift->command("STARTTLS")->response() == CMD_OK } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_STARTTLS: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||
| 618 | { | ||||||||||||||||||||||||||||||||||||||
| 619 | package Net::SMTP::_SSL; | ||||||||||||||||||||||||||||||||||||||
| 620 | 6 | ▶ | our @ISA = ( $ssl_class ? ($ssl_class):(), 'Net::SMTP' ); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 621 | 0 | ▶ | sub starttls { die "SMTP connection is already in SSL mode" } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
starttls: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 622 | 3 | ▶ | sub start_SSL { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
start_SSL: called CC=6 SCAR=19.9
| |||||||||||||||||||||||||||||||||||||||
| 623 | 3 | my ($class,$smtp,%arg) = @_; | |||||||||||||||||||||||||||||||||||||
| 624 | 3 | delete @arg{ grep { !m{^SSL_} } keys %arg }; | |||||||||||||||||||||||||||||||||||||
| 625 | 3 | ▶ | ( $arg{SSL_verifycn_name} ||= $smtp->host ) | ||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$arg{"SSL_verifycn_name"} ||= $smtp->host
MC/DC0%0/2
$arg{"SSL_verifycn_name"} ||= $smtp->host
$arg{"SSL_verifycn_name"}
$smtp->host
Truth table33%1/3
A ||= B
A= $arg{"SSL_verifycn_name"}B= $smtp->host
| |||||||||||||||||||||||||||||||||||||||
| 626 | =~s{(?<!:):[\w()]+$}{}; # strip port | ||||||||||||||||||||||||||||||||||||||
| 627 | $arg{SSL_hostname} = $arg{SSL_verifycn_name} | ||||||||||||||||||||||||||||||||||||||
| 628 | 3 | ▶ | if ! defined $arg{SSL_hostname} && $class->can_client_sni; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $arg{"SSL_hostname"} and $class->can_client_sni
MC/DC0%0/2
not defined $arg{"SSL_hostname"} and $class->can_client_sni
not defined $arg{"SSL_hostname"}
$class->can_client_sni
Truth table33%1/3
not(A) and B
A= not defined $arg{"SSL_hostname"}B= $class->can_client_sni
| |||||||||||||||||||||||||||||||||||||||
| 629 | 3 | ▶ | $arg{SSL_verifycn_scheme} ||= 'smtp'; | ||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$arg{"SSL_verifycn_scheme"} ||= "smtp"
MC/DC0%0/1
$arg{"SSL_verifycn_scheme"} ||= "smtp"
$arg{"SSL_verifycn_scheme"}
Truth table50%1/2
A
A= $arg{"SSL_verifycn_scheme"}
| |||||||||||||||||||||||||||||||||||||||
| 630 | 3 | my $ok = $class->SUPER::start_SSL($smtp,%arg); | |||||||||||||||||||||||||||||||||||||
| 631 | 3 | ▶ | $@ = $ssl_class->errstr if !$ok; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 632 | 3 | return $ok; | |||||||||||||||||||||||||||||||||||||
| 633 | } | ||||||||||||||||||||||||||||||||||||||
| 634 | } | ||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||
| 638 | 6 | 1; | |||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||
| 640 | __END__ | ||||||||||||||||||||||||||||||||||||||