Branch Coverage

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


line true false branch
90 0 0 if $@
91 0 0 $@ ? :
98 0 0 if $@
99 0 0 $@ ? :
105 0 0 if length $pass > $size
149 2 0 if ($TZ eq '')
185 0 0 if ($Mail::Sendmail::server_reply)
187 0 0 if $^W
197 1 14 ref $_[$i] ? :
198 0 15 if ($mailcfg{'debug'} > 5)
199 0 0 if (length $$data < 500) { }
206 0 15 unless print S $$data
217 0 16 if $mailcfg{'debug'} > 5
218 0 16 if (/^[45]/ or not $_)
230 0 8 if ($k =~ /[A-Z]/)
238 0 0 if (not $k and $^W)
250 4 1 unless ($k =~ /^(Message|Body|Text)$/i)
258 1 0 if $smtp and $mailcfg{'smtp'}[0] ne $smtp
273 1 0 if defined $mail{'Message'}
274 0 1 if defined $mail{'Body'}
275 0 1 if defined $mail{'Text'}
286 0 1 unless ($fromaddr =~ /$address_rx/)
301 1 0 unless ($mail{'Content-Transfer-Encoding'} or $mail{'Content-Type'} =~ /multipart/io)
304 1 0 if ($mailcfg{'mime'}) { }
310 0 0 if ($mail{'Message'} =~ /[\x80-\xFF]/o)
312 0 0 if $^W
325 1 0 if defined $mail{'To'}
326 0 1 if defined $mail{'Cc'}
327 0 1 if defined $mail{'Bcc'}
337 0 1 unless (@recipients)
347 0 1 unless (socket S, 2, 1, scalar getprotobyname 'tcp')
351 0 1 if $mailcfg{'debug'} > 1
355 0 1 $server =~ s/:(\d+)$//o ? :
359 0 1 unless ($smtpaddr)
370 0 0 if $mailcfg{'debug'} > 1
371 0 0 if $mailcfg{'debug'} > 1
375 1 0 if ($connected) { }
376 0 1 if $mailcfg{'debug'} > 3
381 0 0 if $mailcfg{'debug'} > 1
386 0 1 unless ($connected)
401 0 1 unless socket_read()
403 0 1 unless socket_write("EHLO $localhost$CRLF")
406 1 0 if ($ehlo) { }
411 10 0 if $k
416 0 0 unless socket_write("HELO $localhost$CRLF")
420 0 1 if ($auth)
421 0 0 if $mailcfg{'debug'} > 4
427 0 0 if (@methods) { }
430 0 0 if (exists $auth->{'pass'})
435 0 0 unless _require_base64()
436 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') { }
437 0 0 if $mailcfg{'debug'} > 9
438 0 0 unless socket_write("AUTH LOGIN$CRLF")
440 0 0 unless socket_read()
442 0 0 unless socket_write(encode_base64($auth->{'user'}, $CRLF))
444 0 0 unless socket_read()
446 0 0 unless socket_write(encode_base64($auth->{'password'}, $CRLF))
448 0 0 unless socket_read()
452 0 0 if $mailcfg{'debug'} > 9
455 0 0 unless socket_write('AUTH PLAIN ' . encode_base64(join("\000", $auth->{'user'}, $auth->{'user'}, $auth->{'password'}), $CRLF))
457 0 0 unless socket_read()
461 0 0 unless _require_md5()
462 0 0 if $mailcfg{'debug'} > 9
463 0 0 unless socket_write("AUTH CRAM-MD5$CRLF")
469 0 0 unless socket_write(encode_base64("$auth->{'user'} $response", $CRLF))
471 0 0 unless socket_read()
475 0 0 unless _require_md5()
476 0 0 if $mailcfg{'debug'} > 9
477 0 0 unless socket_write("AUTH DIGEST-MD5$CRLF")
482 0 0 if $mailcfg{'debug'} > 10
484 0 0 if $mailcfg{'debug'} > 10
485 0 0 unless socket_write(encode_base64($response, ''), $CRLF)
489 0 0 if ($status =~ /^3/)
490 0 0 unless socket_write($CRLF)
492 0 0 unless socket_read()
503 0 0 if ($auth->{'required'}) { }
512 0 1 unless socket_write("MAIL FROM:<$fromaddr>$CRLF")
514 0 1 unless socket_read()
519 0 1 unless socket_write("RCPT TO:<$to>$CRLF")
521 1 0 if (socket_read()) { }
529 0 1 unless ($to_ok)
535 0 1 unless socket_write("DATA$CRLF")
537 0 1 unless socket_read()
542 1 7 if $header eq 'Message'
544 0 7 unless socket_write("${header}: $mail{$header}$CRLF")
554 0 1 unless socket_write($CRLF, \$mail{'Message'}, "$CRLF.$CRLF")
556 0 1 unless socket_read()
561 0 1 unless socket_write("QUIT$CRLF")