Merge branch 'fc/send-email-envelope'

This commit is contained in:
Junio C Hamano 2009-11-30 14:42:50 -08:00
commit 0c7cc135c5
3 changed files with 41 additions and 4 deletions

View File

@ -108,9 +108,10 @@ Sending
--envelope-sender=<address>:: --envelope-sender=<address>::
Specify the envelope sender used to send the emails. Specify the envelope sender used to send the emails.
This is useful if your default address is not the address that is This is useful if your default address is not the address that is
subscribed to a list. If you use the sendmail binary, you must have subscribed to a list. In order to use the 'From' address, set the
suitable privileges for the -f parameter. Default is the value of value to "auto". If you use the sendmail binary, you must have
the 'sendemail.envelopesender' configuration variable; if that is suitable privileges for the -f parameter. Default is the value of the
'sendemail.envelopesender' configuration variable; if that is
unspecified, choosing the envelope sender is left to your MTA. unspecified, choosing the envelope sender is left to your MTA.
--smtp-encryption=<encryption>:: --smtp-encryption=<encryption>::

View File

@ -877,7 +877,9 @@ X-Mailer: git-send-email $gitversion
my @sendmail_parameters = ('-i', @recipients); my @sendmail_parameters = ('-i', @recipients);
my $raw_from = $sanitized_sender; my $raw_from = $sanitized_sender;
$raw_from = $envelope_sender if (defined $envelope_sender); if (defined $envelope_sender && $envelope_sender ne "auto") {
$raw_from = $envelope_sender;
}
$raw_from = extract_valid_address($raw_from); $raw_from = extract_valid_address($raw_from);
unshift (@sendmail_parameters, unshift (@sendmail_parameters,
'-f', $raw_from) if(defined $envelope_sender); '-f', $raw_from) if(defined $envelope_sender);

View File

@ -95,6 +95,40 @@ test_expect_success \
'Verify commandline' \ 'Verify commandline' \
'test_cmp expected commandline1' 'test_cmp expected commandline1'
test_expect_success 'Send patches with --envelope-sender' '
clean_fake_sendmail &&
git send-email --envelope-sender="Patch Contributer <patch@example.com>" --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
'
cat >expected <<\EOF
!patch@example.com!
!-i!
!nobody@example.com!
!author@example.com!
!one@example.com!
!two@example.com!
EOF
test_expect_success \
'Verify commandline' \
'test_cmp expected commandline1'
test_expect_success 'Send patches with --envelope-sender=auto' '
clean_fake_sendmail &&
git send-email --envelope-sender=auto --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
'
cat >expected <<\EOF
!nobody@example.com!
!-i!
!nobody@example.com!
!author@example.com!
!one@example.com!
!two@example.com!
EOF
test_expect_success \
'Verify commandline' \
'test_cmp expected commandline1'
cat >expected-show-all-headers <<\EOF cat >expected-show-all-headers <<\EOF
0001-Second.patch 0001-Second.patch
(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>' (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'