Branch Coverage

blib/lib/Mail/Sender.pm
Criterion Covered Total %
branch 72 734 9.8


line true false branch
84 0 2 unless eval " use IO::Socket::SSL;# qw(debug4);\n use Net::SSLeay;\n 1;\n"
99 0 2 unless $config
105 0 2 if ($compiled or -e $config)
110 0 0 if ($@ and not $@ =~ /Can't locate /)
144 1 1 if ($_[0]) { }
163 1 1 if ($_[0]) { }
187 1 1 if ($_[0]) { }
216 1 1 if defined $username
235 0 0 if ($res =~ s/^(\d\d\d)-/$1 /)
251 0 0 if ($s->opened) { }
262 0 0 if not defined $str or $str eq ''
265 0 0 if ($charset and $str =~ /[^[:ascii:]]/)
271 0 0 if $i < $#parts and $parts[$i + 1] =~ /^\s+$/
273 0 0 if ($part =~ /[^[:ascii:]]/ or $part =~ /[\r\n\t]/) { }
286 0 0 if (length($str) + length($hdr) > 997)
296 0 0 unless ($res =~ /^[123]/)
298 0 0 unless ($res =~ /^[123]/)
305 0 0 if (exists $self->{'supports'}{'AUTH'})
314 0 0 if (exists $self->{'supports'}{'DSN'} and exists $self->{'esmtp'})
317 0 0 if $self->{'esmtp'}{$_} ne ''
321 0 0 if $self->{'esmtp'}{$_} ne ''
330 0 0 unless ($self->{'auth_protocols'}{$auth})
335 0 0 if exists $self->{'username'} and not exists $self->{'authid'}
338 0 0 if exists $self->{'password'} and not exists $self->{'authpwd'}
353 0 0 unless (/^[123]/)
355 0 0 if ($self->{'auth_encoded'}) { }
359 0 0 unless (/^[123]/)
362 0 0 unless (/^[123]/)
366 0 0 unless (/^[123]/)
369 0 0 unless (/^[123]/)
379 0 0 unless (/^[123]/)
380 0 0 if /^\d{3}\s+(.*)$/
382 0 0 unless ($MD5_loaded)
384 0 0 if $@
395 0 0 unless (/^[123]/)
404 0 0 unless (/^[123]/)
409 0 0 unless (/^[123]/)
417 0 0 unless ($NTLM_loaded)
419 0 0 if $@
426 0 0 unless (/^[123]/)
432 0 0 if defined $self->{'authdomain'}
435 0 0 unless (/^3\d\d (.*)$/s)
438 0 0 unless (/^[123]/)
457 0 0 if (defined $file) { }
458 0 0 unless (@Mail::Sender::DBIO::ISA)
461 0 0 if $@
465 0 0 if (not ref $file) { }
466 0 0 unless open my $DEBUG, '>', $file
502 1 1 $msg ? :
510 1 1 if ($msg eq '') { }
524 2 3 if ($err and not $err =~ /Local user/i) { }
604 1 2 if $res
677 2 17 if (ref $this) { }
697 17 2 unless $self->{'port'}
710 18 1 if (@_ != 0)
711 17 1 if (ref $_[0] eq 'HASH') { }
717 1 16 if $self->{'replyto'} and not $self->{'reply'}
731 6 13 if $self->{'to'}
732 5 14 if $self->{'cc'}
733 5 14 if $self->{'bcc'}
735 1 18 if defined $self->{'esmtp'}
738 1 18 if $self->{'fromaddr'}
740 4 15 if ($self->{'replyaddr'})
745 3 16 if ($self->{'smtp'})
749 1 2 unless ($self->{'smtpaddr'} = Socket::inet_aton($self->{'smtp'}))
752 2 0 if $self->{'smtpaddr'} =~ /(.*)/s
755 17 1 if defined $self->{'boundary'}
757 3 15 if defined $self->{'headers'}
764 5 2 if (defined $file and $file =~ /\.(.*)$/)
777 0 0 unless my $s = 'IO::Socket::INET'->new('PeerHost', $self->{'smtp'}, 'PeerPort', $self->{'port'}, 'Proto', 'tcp', 'Timeout', $self->{'timeout'} || 120)
783 0 0 if ($self->{'debug'})
784 0 0 unless eval { do { $s = __Debug($s, $self->{'debug'}) } }
786 0 0 unless defined $self->{'debug_level'}
790 0 0 unless ($_ and /^[123]/)
796 0 0 if $res
799 0 0 if ($self->{'tls_required'} || $self->{'tls_allowed'} and not $TLS_notsupported and defined $self->{'supports'}{'STARTTLS'} || defined $self->{'supports'}{'TLS'}) { }
0 0 elsif ($self->{'tls_required'}) { }
808 0 0 unless -s $Net::SSLeay::random_device
814 0 0 if $code != 220
820 0 0 if (exists $self->{'ssl_version'})
823 0 0 if (exists $self->{'ssl_verify_mode'})
826 0 0 if (exists $self->{'ssl_ca_path'})
829 0 0 if (exists $self->{'ssl_ca_file'})
832 0 0 if (exists $self->{'ssl_verifycb_name'})
835 0 0 if (exists $self->{'ssl_verifycn_schema'})
838 0 0 if (exists $self->{'ssl_hostname'})
842 0 0 if ($self->{'debug'}) { }
848 0 0 unless ($res)
854 0 0 if $res
858 0 0 if ($TLS_notsupported) { }
866 0 0 if ($self->{'auth'} or $self->{'username'})
869 0 0 if $res
878 1 0 if (@_)
879 0 1 if (defined $self->{'socket'})
888 0 1 if ($self->{'die_on_errors'} or $self->{'on_errors'} and $self->{'on_errors'} eq 'die') { }
0 1 elsif (exists $self->{'on_errors'} and !defined($self->{'on_errors'}) || $self->{'on_errors'} eq 'undef') { }
908 1 16 if (ref $self->{$type}) { }
927 2 2 if $self->{'esmtp'}{'ORCPT'} ne '' and not $self->{'esmtp'}{'ORCPT'} =~ /;/
935 1 9 unless exists $self->{'headers'}
936 5 4 if ($self->{'headers'} eq '')
941 2 2 if (ref $self->{'headers'} eq 'HASH') { }
1 1 elsif (ref $self->{'headers'}) { }
950 1 3 if (length $_ > 997)
975 0 0 if (not $self->{'keepconnection'} and $self->{'_data'})
977 0 0 if ($self->{'error'}) { }
992 0 0 if (ref $_[0] eq 'HASH') { }
996 0 0 if defined $hash->{'replyto'} and not defined $hash->{'reply'}
998 0 0 if (ref $hash->{$key} eq 'HASH' and exists $$self{lc $key}) { }
999 0 0 if (ref $$self{lc $key} eq 'HASH') { }
1015 0 0 if ($from)
1016 0 0 if ($reply)
1017 0 0 if ($to)
1018 0 0 if ($smtp)
1019 0 0 if ($subject)
1023 0 0 if ($headers)
1029 0 0 if $changed{'to'}
1030 0 0 if $changed{'cc'}
1031 0 0 if $changed{'bcc'}
1033 0 0 if defined $changed{'esmtp'}
1035 0 0 if defined $changed{'boundary'}
1037 0 0 unless defined $self->{'from'}
1039 0 0 if ($changed{'from'})
1044 0 0 if ($changed{'reply'})
1050 0 0 if ($changed{'smtp'})
1054 0 0 unless (defined $self->{'smtpaddr'})
1057 0 0 if $self->{'smtpaddr'} =~ /(.*)/s
1058 0 0 if (exists $self->{'socket'})
1065 0 0 if $changed{'headers'}
1067 0 0 unless ($self->{'to'})
1069 0 0 unless defined $self->{'smtp'}
1071 0 0 if ($Mail::Sender::{'SiteHook'} and not $self->SiteHook)
1072 0 0 defined $self->{'error'} ? :
1077 0 0 unless ref $s
1083 0 0 unless (/^[123]/)
1087 0 0 if ($self->{'skip_bad_recipients'}) { }
1096 0 0 if ($addr =~ /<(.*)>/) { }
1102 0 0 if (not /^[123]/) { }
1111 0 0 if %failed
1112 0 0 if ($good_count == 0)
1123 0 0 if ($addr =~ /<(.*)>/) { }
1129 0 0 unless (/^[123]/)
1138 0 0 unless (/^[123]/)
1142 0 0 if $self->{'debug'} and $self->{'debug_level'} <= 1
1146 0 0 if defined $self->{'charset'} and not defined $self->{'ctype'}
1149 0 0 if (defined $self->{'encoding'} or defined $self->{'ctype'})
1152 0 0 if defined $self->{'ctype'}
1154 0 0 if defined $self->{'charset'}
1157 0 0 if (defined $self->{'encoding'})
1159 0 0 if ($self->{'encoding'} =~ /Base64/i) { }
0 0 elsif ($self->{'encoding'} =~ /Quoted[_\-]print/i) { }
0 0 elsif ($self->{'encoding'} =~ /^[78]bit$/i) { }
1175 0 0 unless $self->{'code'}
1180 0 0 defined $self->{'fake_to'} ? :
1184 0 0 defined $self->{'fake_from'} ? :
1185 0 0 if (defined $self->{'fake_cc'} and $self->{'fake_cc'}) { }
0 0 elsif (defined $self->{'cc'} and $self->{'cc'}) { }
1192 0 0 if defined $self->{'reply'}
1194 0 0 unless defined $self->{'subject'}
1197 0 0 unless (defined $Mail::Sender::NO_DATE and $Mail::Sender::NO_DATE or defined $self->{'_headers'} and $self->{'_headers'} =~ /^Date:/m or defined $Mail::Sender::SITE_HEADERS and $Mail::Sender::SITE_HEADERS =~ /^Date:/m)
1208 0 0 if ($self->{'priority'})
1210 0 0 if $self->{'priority'} + 0 eq $self->{'priority'}
1214 0 0 if ($self->{'confirm'})
1216 0 0 if ($confirm =~ /^\s*reading\s*(?:\:\s*(.*))?/i) { }
0 0 elsif ($confirm =~ /^\s*delivery\s*(?:\:\s*(.*))?/i) { }
1233 0 0 unless (defined $Mail::Sender::NO_X_MAILER)
1242 0 0 unless (defined $Mail::Sender::NO_MESSAGE_ID and $Mail::Sender::NO_MESSAGE_ID)
1245 0 0 if (not defined $self->{'messageid'} or $self->{'messageid'} eq '')
1246 0 0 if (defined $self->{'createmessageid'} and ref $self->{'createmessageid'} eq 'CODE') { }
1259 0 0 if defined $Mail::Sender::SITE_HEADERS
1264 0 0 if defined $self->{'_headers'} and $self->{'_headers'}
1265 0 0 if defined $headers
1270 0 0 if $self->{'debug'} and $self->{'debug_level'} <= 2
1280 0 0 if (not $self->{'keepconnection'} and $self->{'_data'})
1282 0 0 if ($self->{'error'}) { }
1296 0 0 if (defined $self->{'type'} and $self->{'type'})
1297 0 0 if $self->{'type'} =~ m[^multipart/(.*)]i
1299 0 0 unless $self->{'multipart'}
1302 0 0 if (ref $_[0] eq 'HASH') { }
1305 0 0 if defined $hash->{'subtype'}
1307 0 0 if defined $hash->{'replyto'} and not defined $hash->{'reply'}
1309 0 0 if (ref $hash->{$key} eq 'HASH' and exists $$self{lc $key}) { }
1310 0 0 if (ref $$self{lc $key} eq 'HASH') { }
1326 0 0 if ($from)
1327 0 0 if ($reply)
1328 0 0 if ($to)
1329 0 0 if ($smtp)
1330 0 0 if ($subject)
1334 0 0 if ($headers)
1338 0 0 if ($boundary)
1341 0 0 if $changed{'to'}
1342 0 0 if $changed{'cc'}
1343 0 0 if $changed{'bcc'}
1345 0 0 if defined $changed{'esmtp'}
1347 0 0 if $changed{'boundary'}
1349 0 0 if $changed{'headers'}
1351 0 0 unless defined $self->{'from'}
1352 0 0 if ($changed{'from'})
1357 0 0 if ($changed{'reply'})
1363 0 0 if ($changed{'smtp'})
1367 0 0 unless (defined $self->{'smtpaddr'})
1370 0 0 if $self->{'smtpaddr'} =~ /(.*)/s
1371 0 0 if (exists $self->{'socket'})
1378 0 0 unless ($self->{'to'})
1380 0 0 unless defined $self->{'smtp'}
1384 0 0 if ($Mail::Sender::{'SiteHook'} and not $self->SiteHook)
1385 0 0 defined $self->{'error'} ? :
1390 0 0 unless ref $s
1396 0 0 unless (/^[123]/)
1400 0 0 if ($self->{'skip_bad_recipients'}) { }
1409 0 0 if ($addr =~ /<(.*)>/) { }
1415 0 0 if (not /^[123]/) { }
1423 0 0 if %failed
1424 0 0 if ($good_count == 0)
1435 0 0 if ($addr =~ /<(.*)>/) { }
1441 0 0 unless (/^[123]/)
1450 0 0 unless (/^[123]/)
1454 0 0 if $self->{'debug'} and $self->{'debug_level'} <= 1
1460 0 0 defined $self->{'fake_to'} ? :
1464 0 0 defined $self->{'fake_from'} ? :
1465 0 0 if (defined $self->{'fake_cc'} and $self->{'fake_cc'}) { }
0 0 elsif (defined $self->{'cc'} and $self->{'cc'}) { }
1474 0 0 if defined $self->{'reply'}
1476 0 0 unless defined $self->{'subject'}
1479 0 0 unless (defined $Mail::Sender::NO_DATE and $Mail::Sender::NO_DATE or defined $self->{'_headers'} and $self->{'_headers'} =~ /^Date:/m or defined $Mail::Sender::SITE_HEADERS and $Mail::Sender::SITE_HEADERS =~ /^Date:/m)
1490 0 0 if ($self->{'priority'})
1492 0 0 if $self->{'priority'} + 0 eq $self->{'priority'}
1496 0 0 if ($self->{'confirm'})
1498 0 0 if ($confirm =~ /^\s*reading\s*(?:\:\s*(.*))?/i) { }
0 0 elsif ($confirm =~ /^\s*delivery\s*(?:\:\s*(.*))?/i) { }
1515 0 0 unless (defined $Mail::Sender::NO_X_MAILER and $Mail::Sender::NO_X_MAILER)
1524 0 0 if defined $Mail::Sender::SITE_HEADERS
1527 0 0 unless (defined $Mail::Sender::NO_MESSAGE_ID and $Mail::Sender::NO_MESSAGE_ID)
1530 0 0 if (not defined $self->{'messageid'} or $self->{'messageid'} eq '')
1531 0 0 if (defined $self->{'createmessageid'} and ref $self->{'createmessageid'} eq 'CODE') { }
1545 0 0 if defined $self->{'_headers'} and $self->{'_headers'}
1552 0 0 if $self->{'debug'} and $self->{'debug_level'} <= 2
1564 0 0 unless exists $self->{'socket'} and $self->{'socket'}
1573 0 0 if (ref $_[0] eq 'HASH') { }
1580 0 0 unless $msg
1582 0 0 if (ref $self->Open(@_) and ref $self->SendEnc($msg) and ref $self->Close) { }
1598 0 0 if (ref $_[0] eq 'HASH') { }
1606 0 0 if defined $desc
1615 0 0 if $#_ >= 2
1616 0 0 if defined $desc
1620 0 0 unless $msg
1621 0 0 unless $file
1623 0 0 if (ref $file eq 'ARRAY') { }
0 0 elsif ($file =~ /,/) { }
1633 0 0 unless $file =~ /^&/ or -e $file
1641 0 0 $hash ? :
0 0 unless ref $self->OpenMultipart($hash ? $hash : @_) and ref $self->Body($self->{'b_charset'} || $self->{'charset'}, $self->{'b_encoding'}, $self->{'b_ctype'}) and $self->SendEnc($msg)
1651 0 0 unless defined $haddesc
1657 0 0 defined $self->{'disposition'} ? :
0 0 $ctype =~ /;\s*name(?:\*(?:0\*?)?)?=/ ? :
0 0 defined $charset ? :
1671 0 0 unless open my $FH, '<', $file
1672 0 0 unless $ctype =~ m[^text/]i and $encoding =~ /Quoted[_\-]print|Base64/i
1678 0 0 if defined $self->{'chunk_size'}
1681 0 0 unless $self->{'_had_newline'}
1688 0 0 if ($Error eq '') { }
1719 0 0 unless defined $code
1722 0 0 unless $s = $self->{'socket'}
1723 0 0 if (defined $self->{'chunk_size'}) { }
1726 0 0 if (defined $self->{'_buffer'}) { }
1734 0 0 if (($blen = $len % $chunk) > 0) { }
1745 0 0 unless $self->{'_had_newline'}
1757 0 0 unless $s = $self->{'socket'}
1771 0 0 unless ($self->{'multipart'})
1778 0 0 if (ref $_[0] eq 'HASH') { }
1792 0 0 unless defined $ctype
1793 0 0 unless defined $disposition
1794 0 0 unless defined $encoding
1796 0 0 if (defined $charset and $charset and not $ctype =~ /charset=/i) { }
0 0 elsif (not defined $charset and $ctype =~ /charset="([^"]+)"/) { }
1804 0 0 unless $s = $self->{'socket'}
1807 0 0 if ($encoding =~ /Base64/i) { }
0 0 elsif ($encoding =~ /Quoted[_\-]print/i) { }
1819 0 0 if $self->{'debug'} and $self->{'debug_level'} == 3
1821 0 0 if ($ctype =~ m[^multipart/]i) { }
1829 0 0 if ($description)
1831 0 0 unless $disposition eq '' or uc $disposition eq 'NONE'
1834 0 0 if defined $content_id
1838 0 0 if $self->{'debug'} and $self->{'debug_level'} == 3
1839 0 0 if defined $msg
1848 0 0 unless ($self->{'multipart'})
1851 0 0 if (@_) { }
1862 0 0 if ref $_[0] eq 'HASH'
1868 0 0 unless $ctype =~ /charset=/i
1883 0 0 unless ($self->{'multipart'})
1886 0 0 unless ($self->{'socket'})
1890 0 0 if (ref $_[0] eq 'HASH') { }
1903 0 0 unless $file
1905 0 0 if (ref $file eq 'ARRAY') { }
0 0 elsif ($file =~ /,/) { }
1915 0 0 unless $file =~ /^&/ or -e $file
1919 0 0 unless defined $disposition
1920 0 0 unless $encoding
1924 0 0 if ($self->{'_buffer'})
1931 0 0 if ($encoding =~ /Base64/i) { }
0 0 elsif ($encoding =~ /Quoted[_\-]print/i) { }
1948 0 0 $ctype ? :
1952 0 0 if $self->{'debug'} and $self->{'debug_level'} == 3
1954 0 0 if ($fctype =~ /;\s*name(?:\*(?:0\*?)?)?=/) { }
1962 0 0 if ($description)
1967 0 0 if ($disposition =~ /^(.*)filename=\*(.*)$/i) { }
0 0 elsif ($disposition and uc $disposition ne 'NONE') { }
1974 0 0 if ($content_id)
1975 0 0 if ($content_id eq '*') { }
0 0 elsif ($content_id eq '#') { }
1988 0 0 if $self->{'debug'} and $self->{'debug_level'} == 3
1990 0 0 unless open my $FH, '<', $file
1991 0 0 unless $fctype =~ m[^text/]i and $encoding =~ /Quoted[_\-]print|Base64/i
1996 0 0 if lc $encoding eq 'base64'
1998 0 0 unless $s = $self->{'socket'}
2010 0 0 unless $self->{'_part'}
2014 0 0 unless $s = $self->{'socket'}
2017 0 0 if ($self->{'_buffer'})
2019 0 0 if (defined $code) { }
2027 0 0 if ($self->{'_had_newline'}) { }
2033 0 0 if not $self->{'bypass_outlook_bug'} and $self->{'encoding'} =~ /Quoted[_\-]print/i
2038 0 0 if $self->{'debug'} and $self->{'debug_level'} == 3
2040 0 0 if ($self->{'_part'} > 1) { }
2041 0 0 $end ? :
2045 0 0 $end ? :
2058 0 0 unless $s
2060 0 0 if ($self->{'_data'})
2063 0 0 if ($self->{'_buffer'})
2065 0 0 if (defined $code) { }
2074 0 0 if ($self->{'_part'})
2080 0 0 if $self->{'debug'}
2084 0 0 if (/^[45]\d* (.*)$/)
2091 0 0 if ($_[0] or not $self->{'keepconnection'})
2093 0 0 unless (/^[123]/)
2104 0 0 unless $s = $self->{'socket'}
2112 0 19 if ref $_[0] ne 'Mail::Sender'
2114 0 19 if (defined $self->{'socket'})
2132 0 0 unless defined $self
2136 0 0 if (ref $self) { }
0 0 elsif ($self =~ /::/) { }
2139 0 0 if ($self->{'socket'})
2145 0 0 if (@_)
2150 0 0 unless (defined $self->{'smtpaddr'})
2154 0 0 if $self->{'smtpaddr'} =~ /(.*)/s
2158 0 0 unless @_
2162 0 0 unless ref $self
2166 0 0 unless ref $self
2169 0 0 unless defined $self->{'smtp'}
2175 0 0 unless my $s = 'IO::Socket::INET'->new('PeerHost', $self->{'smtp'}, 'PeerPort', $self->{'port'}, 'Proto', 'tcp', 'Timeout', $self->{'timeout'} || 120)
2181 0 0 unless ($_ and /^[123]/)
2186 0 0 if $res
2193 0 0 if (wantarray) { }
2211 0 0 if (not defined $self) { }
0 0 elsif (ref $self) { }
0 0 elsif ($self =~ /::/) { }
2216 0 0 if ($self->{'socket'})
2220 0 0 if (@_)
2225 0 0 unless (defined $self->{'smtpaddr'})
2229 0 0 if $self->{'smtpaddr'} =~ /(.*)/s
2234 0 0 unless @_
2237 0 0 unless ref $self
2241 0 0 unless ref $self
2244 0 0 unless defined $self->{'smtp'}
2248 0 0 if (exists $self->{'on_errors'} and !defined($self->{'on_errors'}) || $self->{'on_errors'} eq 'undef') { }
0 0 elsif (exists $self->{'on_errors'} and $self->{'on_errors'} eq 'die') { }
2260 0 0 unless ref $res
2262 0 0 unless ref $res
2378 0 0 unless (@Mail::Sender::IO::ISA)