Branch Coverage

blib/lib/Mail/Sendmail.pm
Criterion Covered Total %
branch 51 184 27.7


line true false branch
91 0 0 if $@
92 0 0 $@ ? :
99 0 0 if $@
100 0 0 $@ ? :
106 0 0 if length $pass > $size
150 4 0 if ($TZ eq "")
186 0 0 if ($Mail::Sendmail::server_reply)
188 0 0 if $^W
198 3 42 ref $_[$i] ? :
199 0 45 if ($mailcfg{'debug'} > 5)
200 0 0 if (length $$data < 500) { }
207 0 45 unless print S $$data
218 0 25 if $mailcfg{'debug'} > 5
219 0 25 if (/^[45]/ or not $_)
231 0 24 if ($k =~ /[A-Z]/)
239 0 0 if (not $k and $^W)
251 12 3 unless ($k =~ /^(Message|Body|Text)$/i)
259 1 11 if ($mail{$k} =~ /[\015\012]/)
268 3 0 if $smtp and $mailcfg{'smtp'}[0] ne $smtp
283 3 0 if defined $mail{'Message'}
284 0 3 if defined $mail{'Body'}
285 0 3 if defined $mail{'Text'}
296 0 3 unless ($fromaddr =~ /$address_rx/)
311 3 0 unless ($mail{'Content-Transfer-Encoding'} or $mail{'Content-Type'} =~ /multipart/io)
314 1 2 if ($mailcfg{'mime'}) { }
320 0 2 if ($mail{'Message'} =~ /[\x80-\xFF]/o)
322 0 0 if $^W
335 3 0 if defined $mail{'To'}
336 0 3 if defined $mail{'Cc'}
337 0 3 if defined $mail{'Bcc'}
347 0 3 unless (@recipients)
357 0 3 unless (socket S, 2, 1, scalar getprotobyname "tcp")
361 0 3 if $mailcfg{'debug'} > 1
365 2 1 $server =~ s/:(\d+)$//o ? :
369 0 3 unless ($smtpaddr)
380 0 0 if $mailcfg{'debug'} > 1
381 0 0 if $mailcfg{'debug'} > 1
385 3 0 if ($connected) { }
386 0 3 if $mailcfg{'debug'} > 3
391 0 0 if $mailcfg{'debug'} > 1
396 0 3 unless ($connected)
411 0 3 unless socket_read()
413 0 3 unless socket_write("EHLO $localhost$CRLF")
416 3 0 if ($ehlo) { }
421 7 0 if $k
426 0 0 unless socket_write("HELO $localhost$CRLF")
430 0 3 if ($auth)
431 0 0 if $mailcfg{'debug'} > 4
437 0 0 if (@methods) { }
440 0 0 if (exists $auth->{'pass'})
445 0 0 unless _require_base64()
446 0 0 if ($method eq 'LOGIN') { }
0 0 elsif ($method eq 'PLAIN') { }
0 0 elsif ($method eq 'CRAM-MD5') { }
0 0 elsif ($method eq 'DIGEST-MD5') { }
447 0 0 if $mailcfg{'debug'} > 9
448 0 0 unless socket_write("AUTH LOGIN$CRLF")
450 0 0 unless socket_read()
452 0 0 unless socket_write(encode_base64($auth->{'user'}, $CRLF))
454 0 0 unless socket_read()
456 0 0 unless socket_write(encode_base64($auth->{'password'}, $CRLF))
458 0 0 unless socket_read()
462 0 0 if $mailcfg{'debug'} > 9
465 0 0 unless socket_write('AUTH PLAIN ' . encode_base64(join("\0", $auth->{'user'}, $auth->{'user'}, $auth->{'password'}), $CRLF))
467 0 0 unless socket_read()
471 0 0 unless _require_md5()
472 0 0 if $mailcfg{'debug'} > 9
473 0 0 unless socket_write("AUTH CRAM-MD5$CRLF")
479 0 0 unless socket_write(encode_base64("$auth->{'user'} $response", $CRLF))
481 0 0 unless socket_read()
485 0 0 unless _require_md5()
486 0 0 if $mailcfg{'debug'} > 9
487 0 0 unless socket_write("AUTH DIGEST-MD5$CRLF")
492 0 0 if $mailcfg{'debug'} > 10
494 0 0 if $mailcfg{'debug'} > 10
495 0 0 unless socket_write(encode_base64($response, ""), $CRLF)
499 0 0 if ($status =~ /^3/)
500 0 0 unless socket_write($CRLF)
502 0 0 unless socket_read()
513 0 0 if ($auth->{'required'}) { }
522 0 3 unless socket_write("MAIL FROM:<$fromaddr>$CRLF")
524 0 3 unless socket_read()
529 0 3 unless socket_write("RCPT TO:<$to>$CRLF")
531 3 0 if (socket_read()) { }
539 0 3 unless ($to_ok)
545 0 3 unless socket_write("DATA$CRLF")
547 0 3 unless socket_read()
552 3 21 if $header eq "Message"
554 0 21 unless socket_write("${header}: $mail{$header}$CRLF")
564 0 3 unless socket_write($CRLF, \$mail{'Message'}, "$CRLF.$CRLF")
566 0 3 unless socket_read()
571 0 3 unless socket_write("QUIT$CRLF")