Skip to content

Commit 0c7cc13

Browse files
committed
Merge branch 'fc/send-email-envelope'
2 parents a689fae + c89e324 commit 0c7cc13

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

Documentation/git-send-email.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@ Sending
108108
--envelope-sender=<address>::
109109
Specify the envelope sender used to send the emails.
110110
This is useful if your default address is not the address that is
111-
subscribed to a list. If you use the sendmail binary, you must have
112-
suitable privileges for the -f parameter. Default is the value of
113-
the 'sendemail.envelopesender' configuration variable; if that is
111+
subscribed to a list. In order to use the 'From' address, set the
112+
value to "auto". If you use the sendmail binary, you must have
113+
suitable privileges for the -f parameter. Default is the value of the
114+
'sendemail.envelopesender' configuration variable; if that is
114115
unspecified, choosing the envelope sender is left to your MTA.
115116

116117
--smtp-encryption=<encryption>::

git-send-email.perl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,9 @@ sub send_message
877877

878878
my @sendmail_parameters = ('-i', @recipients);
879879
my $raw_from = $sanitized_sender;
880-
$raw_from = $envelope_sender if (defined $envelope_sender);
880+
if (defined $envelope_sender && $envelope_sender ne "auto") {
881+
$raw_from = $envelope_sender;
882+
}
881883
$raw_from = extract_valid_address($raw_from);
882884
unshift (@sendmail_parameters,
883885
'-f', $raw_from) if(defined $envelope_sender);

t/t9001-send-email.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,40 @@ test_expect_success \
9595
'Verify commandline' \
9696
'test_cmp expected commandline1'
9797

98+
test_expect_success 'Send patches with --envelope-sender' '
99+
clean_fake_sendmail &&
100+
git send-email --envelope-sender="Patch Contributer <[email protected]>" --suppress-cc=sob --from="Example <[email protected]>" [email protected] --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
101+
'
102+
103+
cat >expected <<\EOF
104+
105+
!-i!
106+
107+
108+
109+
110+
EOF
111+
test_expect_success \
112+
'Verify commandline' \
113+
'test_cmp expected commandline1'
114+
115+
test_expect_success 'Send patches with --envelope-sender=auto' '
116+
clean_fake_sendmail &&
117+
git send-email --envelope-sender=auto --suppress-cc=sob --from="Example <[email protected]>" [email protected] --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
118+
'
119+
120+
cat >expected <<\EOF
121+
122+
!-i!
123+
124+
125+
126+
127+
EOF
128+
test_expect_success \
129+
'Verify commandline' \
130+
'test_cmp expected commandline1'
131+
98132
cat >expected-show-all-headers <<\EOF
99133
0001-Second.patch
100134
(mbox) Adding cc: A <[email protected]> from line 'From: A <[email protected]>'

0 commit comments

Comments
 (0)