Skip to content

Commit 09caa24

Browse files
Trent Piephogitster
authored andcommitted
send-email: Add config option for sender address
The sender address, as specified with the '--from' command line option, couldn't be set in the config file. So add a new config option, 'sendemail.from', which sets it. One can use 'sendemail.<identity>.from' as well of course, which is likely the more useful case. The sender address would default to GIT_AUTHOR_IDENT, which is usually the right thing, but this doesn't allow switching based on the identity selected. It's possible to switch the SMTP server and envelope sender by using the '--identity' option, in which case one probably wants to use a different from address as well, but this had to be manually specified. The documentation for 'from' is also corrected somewhat. If '--from' is specified (or the new sendemail.from option is used) then the user isn't prompted. The default with no '--from' option (or sendemail.from option) is GIT_AUTHOR_IDENT first then GIT_COMMITTER_IDENT, not just GIT_COMMITTER_IDENT. Signed-off-by: Trent Piepho <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f01f109 commit 09caa24

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Documentation/git-send-email.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,12 @@ and In-Reply-To headers will be used unless they are removed.
6969
Missing From or In-Reply-To headers will be prompted for.
7070

7171
--from=<address>::
72-
Specify the sender of the emails. This will default to
73-
the value GIT_COMMITTER_IDENT, as returned by "git var -l".
74-
The user will still be prompted to confirm this entry.
72+
Specify the sender of the emails. If not specified on the command line,
73+
the value of the 'sendemail.from' configuration option is used. If
74+
neither the command line option nor 'sendemail.from' are set, then the
75+
user will be prompted for the value. The default for the prompt will be
76+
the value of GIT_AUTHOR_IDENT, or GIT_COMMITTER_IDENT if that is not
77+
set, as returned by "git var -l".
7578

7679
--in-reply-to=<identifier>::
7780
Specify the contents of the first In-Reply-To header.

git-send-email.perl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ sub do_edit {
210210
"envelopesender" => \$envelope_sender,
211211
"multiedit" => \$multiedit,
212212
"confirm" => \$confirm,
213+
"from" => \$sender,
213214
);
214215

215216
# Handle Uncouth Termination

0 commit comments

Comments
 (0)