Allow users to optionally specify their envelope sender.
If your normal user is not the same user you are subscribed to a list with, then the default envelope sender used will cause your messages to bounce or silently vanish into the ether. This patch provides an optional parameter to set the envelope sender. To use it with the sendmail binary, you must have privileges to use the -f parameter! Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Robin H. Johnson committed
Apr 25, 2007 at 19:37 UTC
f073a592d6400b3aa653ce02943535bf917078b5
1 file changed
+9
-1
git-send-email.perl
+9
-1
@@ -79,6 +79,8 @@ Options:
79
80
--dry-run Do everything except actually send the emails.
81
82
+ --envelope-sender Specify the envelope sender used to send the emails.
83
+
84
EOT
85
exit(1);
86
}
@@ -139,6 +141,7 @@ my (@to,@cc,@initial_cc,@bcclist,@xh,
141
my ($chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,
142
$dry_run) = (1, 0, 0, 0, 0);
143
my $smtp_server;
144
+my $envelope_sender;
145
146
# Example reply to:
147
#$initial_reply_to = ''; #<20050203173208.GA23964@foobar.com>';
@@ -177,6 +180,7 @@ my $rc = GetOptions("from=s" => \$from,
180
"suppress-from" => \$suppress_from,
181
"no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc,
182
"dry-run" => \$dry_run,
183
+ "envelope-sender=s" => \$envelope_sender,
184
);
185
186
unless ($rc) {
@@ -476,7 +480,11 @@ X-Mailer: git-send-email $gitversion
480
}
481
482
my @sendmail_parameters = ('-i', @recipients);
479
- my $raw_from = extract_valid_address($from);
483
+ my $raw_from = $from;
484
+ $raw_from = $envelope_sender if (defined $envelope_sender);
485
+ $raw_from = extract_valid_address($raw_from);
486
+ unshift (@sendmail_parameters,
487
+ '-f', $raw_from) if(defined $envelope_sender);
488
489
if ($dry_run) {
490
# We don't want to send the email.