Skip to content

Commit

Permalink
send-email: fix obscure error when encryption=tls and smtp cannot con…
Browse files Browse the repository at this point in the history
…nect

When encryption=tls and we cannot connect to the SMTP server,
git-send-email was printing an obtuse perl error:

  Can't call method "command" on an undefined value
  at git-send-email line 927.

This can occur when smtp host or port is misspelled, or the network
is down, and encryption has been set to tls.

Instead we expect some familiar "Cannot connect to SERVER:PORT"
message.  Fix it to print normal "smtp can't connect" diagnostics.

Signed-off-by: Yakov Lerner <iler.ml@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  • Loading branch information
Yakov Lerner authored and Shawn O. Pearce committed Sep 25, 2009
1 parent e648f8b commit fb3650e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion git-send-email.perl
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ sub send_message
$smtp ||= Net::SMTP->new((defined $smtp_server_port)
? "$smtp_server:$smtp_server_port"
: $smtp_server);
if ($smtp_encryption eq 'tls') {
if ($smtp_encryption eq 'tls' && $smtp) {
require Net::SMTP::SSL;
$smtp->command('STARTTLS');
$smtp->response();
Expand Down

0 comments on commit fb3650e

Please sign in to comment.