From: "Robin H\. Johnson" <robbat2@gentoo.org>
To: git@vger.kernel.org
Cc: junkio@cox.net, Robin@orbis-terrarum.net,
H.Johnson@orbis-terrarum.net, <robbat2@gentoo.org>
Subject: [PATCH] Add sendmail -f support to git-send-email.
Date: Tue, 10 Apr 2007 15:02:13 -0700 [thread overview]
Message-ID: <11762425341841-git-send-email-robbat2@gentoo.org> (raw)
In-Reply-To: 11762424311160-git-send-email-robbat2@gentoo.org
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
next reply other threads:[~2007-04-10 22:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-10 22:02 Robin H. Johnson [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11762425341841-git-send-email-robbat2@gentoo.org \
--to=robbat2@gentoo.org \
--cc=H.Johnson@orbis-terrarum.net \
--cc=Robin@orbis-terrarum.net \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).