Branch Coverage

blib/lib/Mail/Sendmail.pm
Criterion Covered Total %
branch 46 182 25.2


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 2 0 if ($TZ eq "")
186 0 0 if ($Mail::Sendmail::server_reply)
188 0 0 if $^W
198 1 14 ref $_[$i] ? :
199 0 15 if ($mailcfg{'debug'} > 5)
200 0 0 if (length $$data < 500) { }
207 0 15 unless print S $$data
218 0 18 if $mailcfg{'debug'} > 5
219 0 18 if (/^[45]/ or not $_)
231 0 8 if ($k =~ /[A-Z]/)
239 0 0 if (not $k and $^W)
251 4 1 unless ($k =~ /^(Message|Body|Text)$/i)
259 1 0 if $smtp and $mailcfg{'smtp'}[0] ne $smtp
274 1 0 if defined $mail{'Message'}
275 0 1 if defined $mail{'Body'}
276 0 1 if defined $mail{'Text'}
287 0 1 unless ($fromaddr =~ /$address_rx/)
302 1 0 unless ($mail{'Content-Transfer-Encoding'} or $mail{'Content-Type'} =~ /multipart/io)
305 1 0 if ($mailcfg{'mime'}) { }
311 0 0 if ($mail{'Message'} =~ /[\x80-\xFF]/o)
313 0 0 if $^W
326 1 0 if defined $mail{'To'}
327 0 1 if defined $mail{'Cc'}
328 0 1 if defined $mail{'Bcc'}
338 0 1 unless (@recipients)
348 0 1 unless (socket S, 2, 1, scalar getprotobyname "tcp")
352 0 1 if $mailcfg{'debug'} > 1
356 0 1 $server =~ s/:(\d+)$//o ? :
360 0 1 unless ($smtpaddr)
371 0 0 if $mailcfg{'debug'} > 1
372 0 0 if $mailcfg{'debug'} > 1
376 1 0 if ($connected) { }
377 0 1 if $mailcfg{'debug'} > 3
382 0 0 if $mailcfg{'debug'} > 1
387 0 1 unless ($connected)
402 0 1 unless socket_read()
404 0 1 unless socket_write("EHLO $localhost$CRLF")
407 1 0 if ($ehlo) { }
412 12 0 if $k
417 0 0 unless socket_write("HELO $localhost$CRLF")
421 0 1 if ($auth)
422 0 0 if $mailcfg{'debug'} > 4
428 0 0 if (@methods) { }
431 0 0 if (exists $auth->{'pass'})
436 0 0 unless _require_base64()
437 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') { }
438 0 0 if $mailcfg{'debug'} > 9
439 0 0 unless socket_write("AUTH LOGIN$CRLF")
441 0 0 unless socket_read()
443 0 0 unless socket_write(encode_base64($auth->{'user'}, $CRLF))
445 0 0 unless socket_read()
447 0 0 unless socket_write(encode_base64($auth->{'password'}, $CRLF))
449 0 0 unless socket_read()
453 0 0 if $mailcfg{'debug'} > 9
456 0 0 unless socket_write('AUTH PLAIN ' . encode_base64(join("\0", $auth->{'user'}, $auth->{'user'}, $auth->{'password'}), $CRLF))
458 0 0 unless socket_read()
462 0 0 unless _require_md5()
463 0 0 if $mailcfg{'debug'} > 9
464 0 0 unless socket_write("AUTH CRAM-MD5$CRLF")
470 0 0 unless socket_write(encode_base64("$auth->{'user'} $response", $CRLF))
472 0 0 unless socket_read()
476 0 0 unless _require_md5()
477 0 0 if $mailcfg{'debug'} > 9
478 0 0 unless socket_write("AUTH DIGEST-MD5$CRLF")
483 0 0 if $mailcfg{'debug'} > 10
485 0 0 if $mailcfg{'debug'} > 10
486 0 0 unless socket_write(encode_base64($response, ""), $CRLF)
490 0 0 if ($status =~ /^3/)
491 0 0 unless socket_write($CRLF)
493 0 0 unless socket_read()
504 0 0 if ($auth->{'required'}) { }
513 0 1 unless socket_write("MAIL FROM:<$fromaddr>$CRLF")
515 0 1 unless socket_read()
520 0 1 unless socket_write("RCPT TO:<$to>$CRLF")
522 1 0 if (socket_read()) { }
530 0 1 unless ($to_ok)
536 0 1 unless socket_write("DATA$CRLF")
538 0 1 unless socket_read()
543 1 7 if $header eq "Message"
545 0 7 unless socket_write("${header}: $mail{$header}$CRLF")
555 0 1 unless socket_write($CRLF, \$mail{'Message'}, "$CRLF.$CRLF")
557 0 1 unless socket_read()
562 0 1 unless socket_write("QUIT$CRLF")