Branch Coverage

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


line true false branch
86 0 2 unless eval " use IO::Socket::SSL;# qw(debug4);\n use Net::SSLeay;\n 1;\n"
101 0 2 unless $config
107 0 2 if ($compiled or -e $config)
112 0 0 if ($@ and not $@ =~ /Can't locate /)
146 1 1 if ($_[0]) { }
165 1 1 if ($_[0]) { }
189 1 1 if ($_[0]) { }
218 1 1 if defined $username
237 0 0 if ($res =~ s/^(\d\d\d)-/$1 /)
253 0 0 if ($s->opened) { }
264 0 0 if not defined $str or $str eq ''
267 0 0 if ($charset and $str =~ /[^[:ascii:]]/)
273 0 0 if $i < $#parts and $parts[$i + 1] =~ /^\s+$/
275 0 0 if ($part =~ /[^[:ascii:]]/ or $part =~ /[\r\n\t]/) { }
288 0 0 if (length($str) + length($hdr) > 997)
298 0 0 unless ($res =~ /^[123]/)
300 0 0 unless ($res =~ /^[123]/)
307 0 0 if (exists $self->{'supports'}{'AUTH'})
316 0 0 if (exists $self->{'supports'}{'DSN'} and exists $self->{'esmtp'})
319 0 0 if $self->{'esmtp'}{$_} ne ''
323 0 0 if $self->{'esmtp'}{$_} ne ''
332 0 0 unless ($self->{'auth_protocols'}{$auth})
337 0 0 if exists $self->{'username'} and not exists $self->{'authid'}
340 0 0 if exists $self->{'password'} and not exists $self->{'authpwd'}
355 0 0 unless (/^[123]/)
357 0 0 if ($self->{'auth_encoded'}) { }
361 0 0 unless (/^[123]/)
364 0 0 unless (/^[123]/)
368 0 0 unless (/^[123]/)
371 0 0 unless (/^[123]/)
381 0 0 unless (/^[123]/)
382 0 0 if /^\d{3}\s+(.*)$/
384 0 0 unless ($MD5_loaded)
386 0 0 if $@
397 0 0 unless (/^[123]/)
406 0 0 unless (/^[123]/)
411 0 0 unless (/^[123]/)
419 0 0 unless ($NTLM_loaded)
421 0 0 if $@
428 0 0 unless (/^[123]/)
434 0 0 if defined $self->{'authdomain'}
437 0 0 unless (/^3\d\d (.*)$/s)
440 0 0 unless (/^[123]/)
459 0 0 if (defined $file) { }
460 0 0 unless (@Mail::Sender::DBIO::ISA)
463 0 0 if $@
467 0 0 if (not ref $file) { }
468 0 0 unless open my $DEBUG, '>', $file
504 1 1 $msg ? :
512 1 1 if ($msg eq '') { }
526 2 3 if ($err and not $err =~ /Local user/i) { }
606 1 2 if $res
679 2 17 if (ref $this) { }
699 17 2 unless $self->{'port'}
712 18 1 if (@_ != 0)
713 17 1 if (ref $_[0] eq 'HASH') { }
719 1 16 if $self->{'replyto'} and not $self->{'reply'}
733 6 13 if $self->{'to'}
734 5 14 if $self->{'cc'}
735 5 14 if $self->{'bcc'}
737 1 18 if defined $self->{'esmtp'}
740 1 18 if $self->{'fromaddr'}
742 4 15 if ($self->{'replyaddr'})
747 3 16 if ($self->{'smtp'})
751 1 2 unless ($self->{'smtpaddr'} = Socket::inet_aton($self->{'smtp'}))
754 2 0 if $self->{'smtpaddr'} =~ /(.*)/s
757 17 1 if defined $self->{'boundary'}
759 3 15 if defined $self->{'headers'}
766 5 2 if (defined $file and $file =~ /\.(.*)$/)
779 0 0 unless my $s = 'IO::Socket::INET'->new('PeerHost', $self->{'smtp'}, 'PeerPort', $self->{'port'}, 'Proto', 'tcp', 'Timeout', $self->{'timeout'} || 120)
785 0 0 if ($self->{'debug'})
786 0 0 unless eval { do { $s = __Debug($s, $self->{'debug'}) } }
788 0 0 unless defined $self->{'debug_level'}
792 0 0 unless ($_ and /^[123]/)
798 0 0 if $res
801 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'}) { }
810 0 0 unless -s $Net::SSLeay::random_device
816 0 0 if $code != 220
822 0 0 if (exists $self->{'ssl_version'})
825 0 0 if (exists $self->{'ssl_verify_mode'})
828 0 0 if (exists $self->{'ssl_ca_path'})
831 0 0 if (exists $self->{'ssl_ca_file'})
834 0 0 if (exists $self->{'ssl_verifycb_name'})
837 0 0 if (exists $self->{'ssl_verifycn_schema'})
840 0 0 if (exists $self->{'ssl_hostname'})
844 0 0 if ($self->{'debug'}) { }
850 0 0 unless ($res)
856 0 0 if $res
860 0 0 if ($TLS_notsupported) { }
868 0 0 if ($self->{'auth'} or $self->{'username'})
871 0 0 if $res
880 1 0 if (@_)
881 0 1 if (defined $self->{'socket'})
890 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') { }
910 1 16 if (ref $self->{$type}) { }
929 2 2 if $self->{'esmtp'}{'ORCPT'} ne '' and not $self->{'esmtp'}{'ORCPT'} =~ /;/
937 1 9 unless exists $self->{'headers'}
938 5 4 if ($self->{'headers'} eq '')
943 2 2 if (ref $self->{'headers'} eq 'HASH') { }
1 1 elsif (ref $self->{'headers'}) { }
952 1 3 if (length $_ > 997)
977 0 0 if (not $self->{'keepconnection'} and $self->{'_data'})
979 0 0 if ($self->{'error'}) { }
994 0 0 if (ref $_[0] eq 'HASH') { }
998 0 0 if defined $hash->{'replyto'} and not defined $hash->{'reply'}
1000 0 0 if (ref $hash->{$key} eq 'HASH' and exists $$self{lc $key}) { }
1001 0 0 if (ref $$self{lc $key} eq 'HASH') { }
1017 0 0 if ($from)
1018 0 0 if ($reply)
1019 0 0 if ($to)
1020 0 0 if ($smtp)
1021 0 0 if ($subject)
1025 0 0 if ($headers)
1031 0 0 if $changed{'to'}
1032 0 0 if $changed{'cc'}
1033 0 0 if $changed{'bcc'}
1035 0 0 if defined $changed{'esmtp'}
1037 0 0 if defined $changed{'boundary'}
1039 0 0 unless defined $self->{'from'}
1041 0 0 if ($changed{'from'})
1046 0 0 if ($changed{'reply'})
1052 0 0 if ($changed{'smtp'})
1056 0 0 unless (defined $self->{'smtpaddr'})
1059 0 0 if $self->{'smtpaddr'} =~ /(.*)/s
1060 0 0 if (exists $self->{'socket'})
1067 0 0 if $changed{'headers'}
1069 0 0 unless ($self->{'to'})
1071 0 0 unless defined $self->{'smtp'}
1073 0 0 if ($Mail::Sender::{'SiteHook'} and not $self->SiteHook)
1074 0 0 defined $self->{'error'} ? :
1079 0 0 unless ref $s
1085 0 0 unless (/^[123]/)
1089 0 0 if ($self->{'skip_bad_recipients'}) { }
1098 0 0 if ($addr =~ /<(.*)>/) { }
1104 0 0 if (not /^[123]/) { }
1113 0 0 if %failed
1114 0 0 if ($good_count == 0)
1125 0 0 if ($addr =~ /<(.*)>/) { }
1131 0 0 unless (/^[123]/)
1140 0 0 unless (/^[123]/)
1144 0 0 if $self->{'debug'} and $self->{'debug_level'} <= 1
1148 0 0 if defined $self->{'charset'} and not defined $self->{'ctype'}
1151 0 0 if (defined $self->{'encoding'} or defined $self->{'ctype'})
1154 0 0 if defined $self->{'ctype'}
1156 0 0 if defined $self->{'charset'}
1159 0 0 if (defined $self->{'encoding'})
1161 0 0 if ($self->{'encoding'} =~ /Base64/i) { }
0 0 elsif ($self->{'encoding'} =~ /Quoted[_\-]print/i) { }
0 0 elsif ($self->{'encoding'} =~ /^[78]bit$/i) { }
1177 0 0 unless $self->{'code'}
1182 0 0 defined $self->{'fake_to'} ? :
1186 0 0 defined $self->{'fake_from'} ? :
1187 0 0 if (defined $self->{'fake_cc'} and $self->{'fake_cc'}) { }
0 0 elsif (defined $self->{'cc'} and $self->{'cc'}) { }
1194 0 0 if defined $self->{'reply'}
1196 0 0 unless defined $self->{'subject'}
1199 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)
1210 0 0 if ($self->{'priority'})
1212 0 0 if $self->{'priority'} + 0 eq $self->{'priority'}
1216 0 0 if ($self->{'confirm'})
1218 0 0 if ($confirm =~ /^\s*reading\s*(?:\:\s*(.*))?/i) { }
0 0 elsif ($confirm =~ /^\s*delivery\s*(?:\:\s*(.*))?/i) { }
1235 0 0 unless (defined $Mail::Sender::NO_X_MAILER)
1244 0 0 unless (defined $Mail::Sender::NO_MESSAGE_ID and $Mail::Sender::NO_MESSAGE_ID)
1247 0 0 if (not defined $self->{'messageid'} or $self->{'messageid'} eq '')
1248 0 0 if (defined $self->{'createmessageid'} and ref $self->{'createmessageid'} eq 'CODE') { }
1261 0 0 if defined $Mail::Sender::SITE_HEADERS
1266 0 0 if defined $self->{'_headers'} and $self->{'_headers'}
1267 0 0 if defined $headers
1272 0 0 if $self->{'debug'} and $self->{'debug_level'} <= 2
1282 0 0 if (not $self->{'keepconnection'} and $self->{'_data'})
1284 0 0 if ($self->{'error'}) { }
1298 0 0 if (defined $self->{'type'} and $self->{'type'})
1299 0 0 if $self->{'type'} =~ m[^multipart/(.*)]i
1301 0 0 unless $self->{'multipart'}
1304 0 0 if (ref $_[0] eq 'HASH') { }
1307 0 0 if defined $hash->{'subtype'}
1309 0 0 if defined $hash->{'replyto'} and not defined $hash->{'reply'}
1311 0 0 if (ref $hash->{$key} eq 'HASH' and exists $$self{lc $key}) { }
1312 0 0 if (ref $$self{lc $key} eq 'HASH') { }
1328 0 0 if ($from)
1329 0 0 if ($reply)
1330 0 0 if ($to)
1331 0 0 if ($smtp)
1332 0 0 if ($subject)
1336 0 0 if ($headers)
1340 0 0 if ($boundary)
1343 0 0 if $changed{'to'}
1344 0 0 if $changed{'cc'}
1345 0 0 if $changed{'bcc'}
1347 0 0 if defined $changed{'esmtp'}
1349 0 0 if $changed{'boundary'}
1351 0 0 if $changed{'headers'}
1353 0 0 unless defined $self->{'from'}
1354 0 0 if ($changed{'from'})
1359 0 0 if ($changed{'reply'})
1365 0 0 if ($changed{'smtp'})
1369 0 0 unless (defined $self->{'smtpaddr'})
1372 0 0 if $self->{'smtpaddr'} =~ /(.*)/s
1373 0 0 if (exists $self->{'socket'})
1380 0 0 unless ($self->{'to'})
1382 0 0 unless defined $self->{'smtp'}
1386 0 0 if ($Mail::Sender::{'SiteHook'} and not $self->SiteHook)
1387 0 0 defined $self->{'error'} ? :
1392 0 0 unless ref $s
1398 0 0 unless (/^[123]/)
1402 0 0 if ($self->{'skip_bad_recipients'}) { }
1411 0 0 if ($addr =~ /<(.*)>/) { }
1417 0 0 if (not /^[123]/) { }
1425 0 0 if %failed
1426 0 0 if ($good_count == 0)
1437 0 0 if ($addr =~ /<(.*)>/) { }
1443 0 0 unless (/^[123]/)
1452 0 0 unless (/^[123]/)
1456 0 0 if $self->{'debug'} and $self->{'debug_level'} <= 1
1462 0 0 defined $self->{'fake_to'} ? :
1466 0 0 defined $self->{'fake_from'} ? :
1467 0 0 if (defined $self->{'fake_cc'} and $self->{'fake_cc'}) { }
0 0 elsif (defined $self->{'cc'} and $self->{'cc'}) { }
1476 0 0 if defined $self->{'reply'}
1478 0 0 unless defined $self->{'subject'}
1481 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)
1492 0 0 if ($self->{'priority'})
1494 0 0 if $self->{'priority'} + 0 eq $self->{'priority'}
1498 0 0 if ($self->{'confirm'})
1500 0 0 if ($confirm =~ /^\s*reading\s*(?:\:\s*(.*))?/i) { }
0 0 elsif ($confirm =~ /^\s*delivery\s*(?:\:\s*(.*))?/i) { }
1517 0 0 unless (defined $Mail::Sender::NO_X_MAILER and $Mail::Sender::NO_X_MAILER)
1526 0 0 if defined $Mail::Sender::SITE_HEADERS
1529 0 0 unless (defined $Mail::Sender::NO_MESSAGE_ID and $Mail::Sender::NO_MESSAGE_ID)
1532 0 0 if (not defined $self->{'messageid'} or $self->{'messageid'} eq '')
1533 0 0 if (defined $self->{'createmessageid'} and ref $self->{'createmessageid'} eq 'CODE') { }
1547 0 0 if defined $self->{'_headers'} and $self->{'_headers'}
1554 0 0 if $self->{'debug'} and $self->{'debug_level'} <= 2
1566 0 0 unless exists $self->{'socket'} and $self->{'socket'}
1575 0 0 if (ref $_[0] eq 'HASH') { }
1582 0 0 unless $msg
1584 0 0 if (ref $self->Open(@_) and ref $self->SendEnc($msg) and ref $self->Close) { }
1600 0 0 if (ref $_[0] eq 'HASH') { }
1608 0 0 if defined $desc
1617 0 0 if $#_ >= 2
1618 0 0 if defined $desc
1622 0 0 unless $msg
1623 0 0 unless $file
1625 0 0 if (ref $file eq 'ARRAY') { }
0 0 elsif ($file =~ /,/) { }
1635 0 0 unless $file =~ /^&/ or -e $file
1643 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)
1653 0 0 unless defined $haddesc
1659 0 0 defined $self->{'disposition'} ? :
0 0 $ctype =~ /;\s*name(?:\*(?:0\*?)?)?=/ ? :
0 0 defined $charset ? :
1673 0 0 unless open my $FH, '<', $file
1674 0 0 unless $ctype =~ m[^text/]i and $encoding =~ /Quoted[_\-]print|Base64/i
1680 0 0 if defined $self->{'chunk_size'}
1683 0 0 unless $self->{'_had_newline'}
1690 0 0 if ($Error eq '') { }
1721 0 0 unless defined $code
1724 0 0 unless $s = $self->{'socket'}
1725 0 0 if (defined $self->{'chunk_size'}) { }
1728 0 0 if (defined $self->{'_buffer'}) { }
1736 0 0 if (($blen = $len % $chunk) > 0) { }
1747 0 0 unless $self->{'_had_newline'}
1759 0 0 unless $s = $self->{'socket'}
1773 0 0 unless ($self->{'multipart'})
1780 0 0 if (ref $_[0] eq 'HASH') { }
1794 0 0 unless defined $ctype
1795 0 0 unless defined $disposition
1796 0 0 unless defined $encoding
1798 0 0 if (defined $charset and $charset and not $ctype =~ /charset=/i) { }
0 0 elsif (not defined $charset and $ctype =~ /charset="([^"]+)"/) { }
1806 0 0 unless $s = $self->{'socket'}
1809 0 0 if ($encoding =~ /Base64/i) { }
0 0 elsif ($encoding =~ /Quoted[_\-]print/i) { }
1821 0 0 if $self->{'debug'} and $self->{'debug_level'} == 3
1823 0 0 if ($ctype =~ m[^multipart/]i) { }
1831 0 0 if ($description)
1833 0 0 unless $disposition eq '' or uc $disposition eq 'NONE'
1836 0 0 if defined $content_id
1840 0 0 if $self->{'debug'} and $self->{'debug_level'} == 3
1841 0 0 if defined $msg
1850 0 0 unless ($self->{'multipart'})
1853 0 0 if (@_) { }
1864 0 0 if ref $_[0] eq 'HASH'
1870 0 0 unless $ctype =~ /charset=/i
1885 0 0 unless ($self->{'multipart'})
1888 0 0 unless ($self->{'socket'})
1892 0 0 if (ref $_[0] eq 'HASH') { }
1905 0 0 unless $file
1907 0 0 if (ref $file eq 'ARRAY') { }
0 0 elsif ($file =~ /,/) { }
1917 0 0 unless $file =~ /^&/ or -e $file
1921 0 0 unless defined $disposition
1922 0 0 unless $encoding
1926 0 0 if ($self->{'_buffer'})
1933 0 0 if ($encoding =~ /Base64/i) { }
0 0 elsif ($encoding =~ /Quoted[_\-]print/i) { }
1950 0 0 $ctype ? :
1954 0 0 if $self->{'debug'} and $self->{'debug_level'} == 3
1956 0 0 if ($fctype =~ /;\s*name(?:\*(?:0\*?)?)?=/) { }
1964 0 0 if ($description)
1969 0 0 if ($disposition =~ /^(.*)filename=\*(.*)$/i) { }
0 0 elsif ($disposition and uc $disposition ne 'NONE') { }
1976 0 0 if ($content_id)
1977 0 0 if ($content_id eq '*') { }
0 0 elsif ($content_id eq '#') { }
1990 0 0 if $self->{'debug'} and $self->{'debug_level'} == 3
1992 0 0 unless open my $FH, '<', $file
1993 0 0 unless $fctype =~ m[^text/]i and $encoding =~ /Quoted[_\-]print|Base64/i
1998 0 0 if lc $encoding eq 'base64'
2000 0 0 unless $s = $self->{'socket'}
2012 0 0 unless $self->{'_part'}
2016 0 0 unless $s = $self->{'socket'}
2019 0 0 if ($self->{'_buffer'})
2021 0 0 if (defined $code) { }
2029 0 0 if ($self->{'_had_newline'}) { }
2035 0 0 if not $self->{'bypass_outlook_bug'} and $self->{'encoding'} =~ /Quoted[_\-]print/i
2040 0 0 if $self->{'debug'} and $self->{'debug_level'} == 3
2042 0 0 if ($self->{'_part'} > 1) { }
2043 0 0 $end ? :
2047 0 0 $end ? :
2060 0 0 unless $s
2062 0 0 if ($self->{'_data'})
2065 0 0 if ($self->{'_buffer'})
2067 0 0 if (defined $code) { }
2076 0 0 if ($self->{'_part'})
2082 0 0 if $self->{'debug'}
2086 0 0 if (/^[45]\d* (.*)$/)
2093 0 0 if ($_[0] or not $self->{'keepconnection'})
2095 0 0 unless (/^[123]/)
2106 0 0 unless $s = $self->{'socket'}
2114 0 19 if ref $_[0] ne 'Mail::Sender'
2116 0 19 if (defined $self->{'socket'})
2134 0 0 unless defined $self
2138 0 0 if (ref $self) { }
0 0 elsif ($self =~ /::/) { }
2141 0 0 if ($self->{'socket'})
2147 0 0 if (@_)
2152 0 0 unless (defined $self->{'smtpaddr'})
2156 0 0 if $self->{'smtpaddr'} =~ /(.*)/s
2160 0 0 unless @_
2164 0 0 unless ref $self
2168 0 0 unless ref $self
2171 0 0 unless defined $self->{'smtp'}
2177 0 0 unless my $s = 'IO::Socket::INET'->new('PeerHost', $self->{'smtp'}, 'PeerPort', $self->{'port'}, 'Proto', 'tcp', 'Timeout', $self->{'timeout'} || 120)
2183 0 0 unless ($_ and /^[123]/)
2188 0 0 if $res
2195 0 0 if (wantarray) { }
2213 0 0 if (not defined $self) { }
0 0 elsif (ref $self) { }
0 0 elsif ($self =~ /::/) { }
2218 0 0 if ($self->{'socket'})
2222 0 0 if (@_)
2227 0 0 unless (defined $self->{'smtpaddr'})
2231 0 0 if $self->{'smtpaddr'} =~ /(.*)/s
2236 0 0 unless @_
2239 0 0 unless ref $self
2243 0 0 unless ref $self
2246 0 0 unless defined $self->{'smtp'}
2250 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') { }
2262 0 0 unless ref $res
2264 0 0 unless ref $res
2380 0 0 unless (@Mail::Sender::IO::ISA)