{"thread":{"id":"47601","subject":"[PATCH] send-email: Support separate Reply-To address","startedAt":"2018-01-12T10:48:13Z","lastAt":"2018-01-12T12:40:23Z","messageCount":2,"participants":["Christian Ludwig","SZEDER Gábor"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"336497","messageId":"20180112104751.28263-1-chrissicool@gmail.com","threadId":"47601","inReplyTo":null,"subject":"[PATCH] send-email: Support separate Reply-To address","fromName":"Christian Ludwig","fromEmail":"chrissicool@googlemail.com","sentAt":"2018-01-12T10:47:51Z","receivedAt":"2018-01-12T10:48:13Z","isPatch":true,"sender":{"key":"chrissicool@gmail.com","avatar":"https://avatars.githubusercontent.com/u/232590?v=4"},"body":"In some projects contributions from groups are only accepted from a\ncommon group email address. But every individual may want to recieve\nreplies to her own personal address. That's what we have 'Reply-To'\nheaders for in SMTP.\n\nIntroduce an optional '--reply-to' command line option. Unfortunately\nthe $reply_to variable name was already taken for the 'In-Reply-To'\nheader field. To reduce code churn, use $reply_address as variable\nname instead.\n\nSigned-off-by: Christian Ludwig <chrissicool@gmail.com>\n---\n Documentation/git-send-email.txt |  5 +++++\n git-send-email.perl              | 18 +++++++++++++++++-\n t/t9001-send-email.sh            |  2 ++\n 3 files changed, 24 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex 8060ea35c..c3bc622b1 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -84,6 +84,11 @@ See the CONFIGURATION section for `sendemail.multiEdit`.\n \tthe value of GIT_AUTHOR_IDENT, or GIT_COMMITTER_IDENT if that is not\n \tset, as returned by \"git var -l\".\n \n+--reply-to=<address>::\n+\tSpecify the address that replies from reciepients should\n+\tto go. Use this if replies to messages should go to another\n+\taddress than what is specified with the --from parameter.\n+\n --in-reply-to=<identifier>::\n \tMake the first mail (or all the mails with `--no-thread`) appear as a\n \treply to the given Message-Id, which avoids breaking threads to\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex edcc6d346..fc21081d3 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -56,6 +56,7 @@ git send-email --dump-aliases\n     --[no-]cc               <str>  * Email Cc:\n     --[no-]bcc              <str>  * Email Bcc:\n     --subject               <str>  * Email \"Subject:\"\n+    --reply-to              <str>  * Email \"Reply-To:\"\n     --in-reply-to           <str>  * Email \"In-Reply-To:\"\n     --[no-]xmailer                 * Add \"X-Mailer:\" header (default).\n     --[no-]annotate                * Review each patch that will be sent in an editor.\n@@ -166,7 +167,7 @@ my $re_encoded_word = qr/=\\?($re_token)\\?($re_token)\\?($re_encoded_text)\\?=/;\n \n # Variables we fill in automatically, or via prompting:\n my (@to,$no_to,@initial_to,@cc,$no_cc,@initial_cc,@bcclist,$no_bcc,@xh,\n-\t$initial_reply_to,$initial_subject,@files,\n+\t$initial_reply_to,$reply_address,$initial_subject,@files,\n \t$author,$sender,$smtp_authpass,$annotate,$use_xmailer,$compose,$time);\n \n my $envelope_sender;\n@@ -315,6 +316,7 @@ die __(\"--dump-aliases incompatible with other options\\n\")\n $rc = GetOptions(\n \t\t    \"sender|from=s\" => \\$sender,\n                     \"in-reply-to=s\" => \\$initial_reply_to,\n+\t\t    \"reply-to=s\" => \\$reply_address,\n \t\t    \"subject=s\" => \\$initial_subject,\n \t\t    \"to=s\" => \\@initial_to,\n \t\t    \"to-cmd=s\" => \\$to_cmd,\n@@ -677,6 +679,7 @@ if ($compose) {\n \tmy $tpl_sender = $sender || $repoauthor || $repocommitter || '';\n \tmy $tpl_subject = $initial_subject || '';\n \tmy $tpl_reply_to = $initial_reply_to || '';\n+\tmy $tpl_reply_address = $reply_address || '';\n \n \tprint $c <<EOT1, Git::prefix_lines(\"GIT: \", __ <<EOT2), <<EOT3;\n From $tpl_sender # This line is ignored.\n@@ -688,6 +691,7 @@ for the patch you are writing.\n Clear the body content if you don't wish to send a summary.\n EOT2\n From: $tpl_sender\n+Reply-To: $tpl_reply_address\n Subject: $tpl_subject\n In-Reply-To: $tpl_reply_to\n \n@@ -738,6 +742,9 @@ EOT3\n \t\t} elsif (/^In-Reply-To:\\s*(.+)\\s*$/i) {\n \t\t\t$initial_reply_to = $1;\n \t\t\tnext;\n+\t\t} elsif (/^Reply-To:\\s*(.+)\\s*$/i) {\n+\t\t\t$reply_address = $1;\n+\t\t\tnext;\n \t\t} elsif (/^From:\\s*(.+)\\s*$/i) {\n \t\t\t$sender = $1;\n \t\t\tnext;\n@@ -884,6 +891,12 @@ if (defined $initial_reply_to) {\n \t$initial_reply_to = \"<$initial_reply_to>\" if $initial_reply_to ne '';\n }\n \n+if (defined $reply_address) {\n+\t$reply_address =~ s/^\\s+|\\s+$//g;\n+\t($reply_address) = expand_aliases($reply_address);\n+\t$reply_address = sanitize_address($reply_address);\n+}\n+\n if (!defined $smtp_server) {\n \tmy @sendmail_paths = qw( /usr/sbin/sendmail /usr/lib/sendmail );\n \tpush @sendmail_paths, map {\"$_/sendmail\"} split /:/, $ENV{PATH};\n@@ -1315,6 +1328,9 @@ Message-Id: $message_id\n \t\t$header .= \"In-Reply-To: $reply_to\\n\";\n \t\t$header .= \"References: $references\\n\";\n \t}\n+\tif ($reply_address) {\n+\t\t$header .= \"Reply-To: $reply_address\\n\";\n+\t}\n \tif (@xh) {\n \t\t$header .= join(\"\\n\", @xh) . \"\\n\";\n \t}\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 81869d891..c62318a78 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -205,6 +205,7 @@ Message-Id: MESSAGE-ID-STRING\n X-Mailer: X-MAILER-STRING\n In-Reply-To: <unique-message-id@example.com>\n References: <unique-message-id@example.com>\n+Reply-To: Reply <reply@example.com>\n \n Result: OK\n EOF\n@@ -297,6 +298,7 @@ test_expect_success $PREREQ 'Show all headers' '\n \t\t--dry-run \\\n \t\t--suppress-cc=sob \\\n \t\t--from=\"Example <from@example.com>\" \\\n+\t\t--reply-to=\"Reply <reply@example.com>\" \\\n \t\t--to=to@example.com \\\n \t\t--cc=cc@example.com \\\n \t\t--bcc=bcc@example.com \\\n-- \n2.15.1\n\n"},{"id":"336499","messageId":"20180112123943.21227-1-szeder.dev@gmail.com","threadId":"47601","inReplyTo":"20180112104751.28263-1-chrissicool@gmail.com","subject":"Re: [PATCH] send-email: Support separate Reply-To address","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2018-01-12T12:39:43Z","receivedAt":"2018-01-12T12:40:23Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"> In some projects contributions from groups are only accepted from a\n> common group email address. But every individual may want to recieve\n> replies to her own personal address. That's what we have 'Reply-To'\n> headers for in SMTP.\n> \n> Introduce an optional '--reply-to' command line option. Unfortunately\n> the $reply_to variable name was already taken for the 'In-Reply-To'\n> header field. To reduce code churn, use $reply_address as variable\n> name instead.\n\nThat $reply_to variable is only accessed in 6 lines.  I wouldn't\nconsider it that much of a code churn to rename it in a preparatory\npatch.\n\n> Signed-off-by: Christian Ludwig <chrissicool@gmail.com>\n> ---\n>  Documentation/git-send-email.txt |  5 +++++\n>  git-send-email.perl              | 18 +++++++++++++++++-\n>  t/t9001-send-email.sh            |  2 ++\n>  3 files changed, 24 insertions(+), 1 deletion(-)\n\nPlease add the new option to the completion script as well, to keep it\nup to date.\n\n> diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\n> index 8060ea35c..c3bc622b1 100644\n> --- a/Documentation/git-send-email.txt\n> +++ b/Documentation/git-send-email.txt\n> @@ -84,6 +84,11 @@ See the CONFIGURATION section for `sendemail.multiEdit`.\n>  \tthe value of GIT_AUTHOR_IDENT, or GIT_COMMITTER_IDENT if that is not\n>  \tset, as returned by \"git var -l\".\n>  \n> +--reply-to=<address>::\n> +\tSpecify the address that replies from reciepients should\n\ns/reciepients/recipients/\n\nAnd I don't like that \"that\" and would prefer e.g. \"where\" instead,\nbut I'd rather leave this to the native English speakers.\n\n> +\tto go. Use this if replies to messages should go to another\n\ns/to go/go to/\n\n"}]}