Skip to content

Commit

Permalink
Allow users to optionally specify their envelope sender.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
robbat2 authored and Junio C Hamano committed Apr 26, 2007
1 parent 2b69bfc commit f073a59
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion git-send-email.perl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ sub usage {
--dry-run Do everything except actually send the emails.
--envelope-sender Specify the envelope sender used to send the emails.
EOT
exit(1);
}
Expand Down Expand Up @@ -139,6 +141,7 @@ sub format_2822_time {
my ($chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,
$dry_run) = (1, 0, 0, 0, 0);
my $smtp_server;
my $envelope_sender;

# Example reply to:
#$initial_reply_to = ''; #<20050203173208.GA23964@foobar.com>';
Expand Down Expand Up @@ -177,6 +180,7 @@ sub format_2822_time {
"suppress-from" => \$suppress_from,
"no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc,
"dry-run" => \$dry_run,
"envelope-sender=s" => \$envelope_sender,
);

unless ($rc) {
Expand Down Expand Up @@ -476,7 +480,11 @@ sub send_message
}

my @sendmail_parameters = ('-i', @recipients);
my $raw_from = extract_valid_address($from);
my $raw_from = $from;
$raw_from = $envelope_sender if (defined $envelope_sender);
$raw_from = extract_valid_address($raw_from);
unshift (@sendmail_parameters,
'-f', $raw_from) if(defined $envelope_sender);

if ($dry_run) {
# We don't want to send the email.
Expand Down

0 comments on commit f073a59

Please sign in to comment.