Debugging cleanup improvements
authorRobin H. Johnson <robbat2@gentoo.org>
Thu, 26 Apr 2007 02:37:17 +0000 (19:37 -0700)
committerJunio C Hamano <junkio@cox.net>
Thu, 26 Apr 2007 04:01:40 +0000 (21:01 -0700)
The debug output is much more helpful if it has the parameters that were used.
Pull the sendmail parameters into a seperate array for that, and also include
similar data during the Net::SMTP case.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-send-email.perl
index 50d45fe00547e7ab784e095025c15ba2c51064ba..36795c8bddc597e44f6e2193eab38359725a83d6 100755 (executable)
@@ -465,15 +465,15 @@ sub send_message
                $header .= join("\n", @xh) . "\n";
        }
 
+       my @sendmail_parameters = ('-i', map { extract_valid_address($_) } @recipients);
+
        if ($dry_run) {
                # We don't want to send the email.
        } elsif ($smtp_server =~ m#^/#) {
                my $pid = open my $sm, '|-';
                defined $pid or die $!;
                if (!$pid) {
-                       exec($smtp_server,'-i',
-                            map { extract_valid_address($_) }
-                            @recipients) or die $!;
+                       exec($smtp_server, @sendmail_parameters) or die $!;
                }
                print $sm "$header\n$message";
                close $sm or die $?;
@@ -493,8 +493,10 @@ sub send_message
                print (($dry_run ? "Dry-" : "")."OK. Log says:\nDate: $date\n");
                if ($smtp) {
                        print "Server: $smtp_server\n";
+                       print "MAIL FROM: $from\n";
+                       print "RCPT TO: ".join(',',@recipients)."\n";
                } else {
-                       print "Sendmail: $smtp_server\n";
+                       print "Sendmail: $smtp_server ".join(' ',@sendmail_parameters)."\n";
                }
                print "From: $from\nSubject: $subject\nCc: $cc\nTo: $to\n\n";
                if ($smtp) {