git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] send-email: Add config option for sender address

From
TPTrent Piepho <xyzzy@speakeasy.org>
Date
May 12, 2009, 22:48 UTC
Message-ID
<1242168536-15057-1-git-send-email-xyzzy@speakeasy.org>
In-Reply-To
<7v1vrxhu8x.fsf@gitster.siamese.dyndns.org>

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 <xyzzy@speakeasy.org>
---
v2: Updated to latest git
 Documentation/git-send-email.txt |    9 ++++++---
 git-send-email.perl              |    1 +
 2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 794224b..f940770 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -69,9 +69,12 @@ and In-Reply-To headers will be used unless they are removed.
 Missing From or In-Reply-To headers will be prompted for.
 
 --from=<address>::
-	Specify the sender of the emails.  This will default to
-	the value GIT_COMMITTER_IDENT, as returned by "git var -l".
-	The user will still be prompted to confirm this entry.
+	Specify the sender of the emails.  If not specified on the command line,
+	the value of the 'sendemail.from' configuration option is used.  If
+	neither the command line option nor 'sendemail.from' are set, then the
+	user will be prompted for the value.  The default for the prompt will be
+	the value of GIT_AUTHOR_IDENT, or GIT_COMMITTER_IDENT if that is not
+	set, as returned by "git var -l".
 
 --in-reply-to=<identifier>::
 	Specify the contents of the first In-Reply-To header.
diff --git a/git-send-email.perl b/git-send-email.perl
index cccbf45..d9c7f32 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -210,6 +210,7 @@ my %config_settings = (
     "envelopesender" => \$envelope_sender,
     "multiedit" => \$multiedit,
     "confirm"   => \$confirm,
+    "from" => \$sender,
 );
 
 # Handle Uncouth Termination
-- 
1.5.4.1
Previous: Junio C Hamano
Message 4 of 4 in “send-email: Add config option for sender address”
  1. send-email: Add config option for sender addressTrent Piepho, Feb 19, 2009
  2. Nanako ShiraishiApr 10, 2009
  3. Junio C HamanoApr 13, 2009
  4. send-email: Add config option for sender addressTrent Piepho, May 12, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.