git-send-email.perl: add option --smtp-debug
Signed-off-by: Jari Aalto <jari.aalto@cante.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jari Aalto committed
Mar 14, 2010 at 17:16 UTC
f60812efa3a790b0a2be389b7531a090d8369892
1 file changed
+7
-2
git-send-email.perl
+7
-2
@@ -64,6 +64,7 @@ git send-email [options] <file | directory | rev-list options >
64
--smtp-pass <str> * Password for SMTP-AUTH; not necessary.
65
--smtp-encryption <str> * tls or ssl; anything else disables.
66
--smtp-ssl * Deprecated. Use '--smtp-encryption ssl'.
67
+ --smtp-debug <0|1> * Disable, enable Net::SMTP debug.
68
69
Automating:
70
--identity <str> * Use the sendemail.<id> options.
@@ -187,6 +188,8 @@ my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
188
my ($validate, $confirm);
189
my (@suppress_cc);
190
191
+my ($debug_net_smtp) = 0; # Net::SMTP, see send_message()
192
+
193
my $not_set_by_user = "true but not set by the user";
194
195
my %config_bool_settings = (
@@ -270,6 +273,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
273
"smtp-pass:s" => \$smtp_authpass,
274
"smtp-ssl" => sub { $smtp_encryption = 'ssl' },
275
"smtp-encryption=s" => \$smtp_encryption,
276
+ "smtp-debug:i" => \$debug_net_smtp,
277
"identity=s" => \$identity,
278
"annotate" => \$annotate,
279
"compose" => \$compose,
@@ -938,7 +942,8 @@ X-Mailer: git-send-email $gitversion
942
require Net::SMTP;
943
$smtp ||= Net::SMTP->new((defined $smtp_server_port)
944
? "$smtp_server:$smtp_server_port"
941
- : $smtp_server);
945
+ : $smtp_server,
946
+ Debug => $debug_net_smtp);
947
if ($smtp_encryption eq 'tls' && $smtp) {
948
require Net::SMTP::SSL;
949
$smtp->command('STARTTLS');
@@ -957,7 +962,7 @@ X-Mailer: git-send-email $gitversion
962
}
963
964
if (!$smtp) {
960
- die "Unable to initialize SMTP properly. Check config. ",
965
+ die "Unable to initialize SMTP properly. Check config and use --smtp-debug. ",
966
"VALUES: server=$smtp_server ",
967
"encryption=$smtp_encryption ",
968
defined $smtp_server_port ? "port=$smtp_server_port" : "";