git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add sendmail -f support to git-send-email.
@ 2007-04-10 22:02 Robin H. Johnson
  2007-04-10 22:02 ` [PATCH] Make envelope-sender fully configurable Robin H. Johnson
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Robin H. Johnson @ 2007-04-10 22:02 UTC (permalink / raw)
  To: git; +Cc: junkio, Robin, H.Johnson, robbat2

Some mailing lists use the envelope sender instead of the actual from address,
and this can be broken in git-send-email. This patch sets the -f argument to
the sendmail binary, using the address of the patch author.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
---
 git-send-email.perl |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index ae50990..2436aec 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -34,7 +34,6 @@ sub readline {
 }
 package main;
 
-
 sub usage {
 	print <<EOT;
 git-send-email [options] <file | directory>...
@@ -446,6 +445,7 @@ sub send_message
 		my ($name, $addr) = ($from =~ /^(.*?)(\s+<.*)/);
 		$from = "\"$name\"$addr";
 	}
+	my ($author_addr) = ($from =~ /^.*?\s+<(.*?)>/);
 	my $header = "From: $from
 To: $to
 Cc: $cc
@@ -462,16 +462,15 @@ X-Mailer: git-send-email $gitversion
 	if (@xh) {
 		$header .= join("\n", @xh) . "\n";
 	}
-
+	
+	my @sendmail_args = ('-f',$author_addr,'-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_args) or die $!;
 		}
 		print $sm "$header\n$message";
 		close $sm or die $?;
@@ -493,6 +492,11 @@ X-Mailer: git-send-email $gitversion
 			print "Server: $smtp_server\n";
 		} else {
 			print "Sendmail: $smtp_server\n";
+			my $s = "";
+			foreach my $a (@sendmail_args) {
+				$s .= " \'".$a."\'";
+			}
+			print "Args:$s\n";
 		}
 		print "From: $from\nSubject: $subject\nCc: $cc\nTo: $to\n\n";
 		if ($smtp) {
-- 
1.5.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-04-11  9:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-10 22:02 [PATCH] Add sendmail -f support to git-send-email Robin H. Johnson
2007-04-10 22:02 ` [PATCH] Make envelope-sender fully configurable Robin H. Johnson
2007-04-10 22:06 ` [PATCH] Add sendmail -f support to git-send-email Robin H. Johnson
2007-04-10 22:38 ` Frank Lichtenheld
2007-04-10 22:42   ` Robin H. Johnson
2007-04-10 23:00   ` Junio C Hamano
2007-04-11  0:38     ` Frank Lichtenheld
2007-04-11  5:18       ` Junio C Hamano
2007-04-11  8:57       ` Lukas Sandström

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).