@@ -57,6 +57,7 @@ sub usage {
57
57
--[no-]cc <str> * Email Cc:
58
58
--[no-]bcc <str> * Email Bcc:
59
59
--subject <str> * Email "Subject:"
60
+ --reply-to <str> * Email "Reply-To:"
60
61
--in-reply-to <str> * Email "In-Reply-To:"
61
62
--[no-]xmailer * Add "X-Mailer:" header (default).
62
63
--[no-]annotate * Review each patch that will be sent in an editor.
@@ -167,13 +168,13 @@ sub format_2822_time {
167
168
168
169
# Variables we fill in automatically, or via prompting:
169
170
my (@to ,$no_to ,@initial_to ,@cc ,$no_cc ,@initial_cc ,@bcclist ,$no_bcc ,@xh ,
170
- $initial_reply_to ,$initial_subject ,@files ,
171
+ $initial_in_reply_to , $reply_to ,$initial_subject ,@files ,
171
172
$author ,$sender ,$smtp_authpass ,$annotate ,$use_xmailer ,$compose ,$time );
172
173
173
174
my $envelope_sender ;
174
175
175
176
# Example reply to:
176
- # $initial_reply_to = ''; #<[email protected] >';
177
+ # $initial_in_reply_to = ''; #<[email protected] >';
177
178
178
179
my $repo = eval { Git-> repository() };
179
180
my @repo = $repo ? ($repo ) : ();
@@ -315,7 +316,8 @@ sub signal_handler {
315
316
if !$help and $dump_aliases and @ARGV ;
316
317
$rc = GetOptions(
317
318
" sender|from=s" => \$sender ,
318
- " in-reply-to=s" => \$initial_reply_to ,
319
+ " in-reply-to=s" => \$initial_in_reply_to ,
320
+ " reply-to=s" => \$reply_to ,
319
321
" subject=s" => \$initial_subject ,
320
322
" to=s" => \@initial_to ,
321
323
" to-cmd=s" => \$to_cmd ,
@@ -681,7 +683,8 @@ sub get_patch_subject {
681
683
682
684
my $tpl_sender = $sender || $repoauthor || $repocommitter || ' ' ;
683
685
my $tpl_subject = $initial_subject || ' ' ;
684
- my $tpl_reply_to = $initial_reply_to || ' ' ;
686
+ my $tpl_in_reply_to = $initial_in_reply_to || ' ' ;
687
+ my $tpl_reply_to = $reply_to || ' ' ;
685
688
686
689
print $c <<EOT1 , Git::prefix_lines(" GIT: " , __ <<EOT2 ), <<EOT3 ;
687
690
From $tpl_sender # This line is ignored.
@@ -693,8 +696,9 @@ sub get_patch_subject {
693
696
Clear the body content if you don' t wish to send a summary.
694
697
EOT2
695
698
From: $tpl_sender
699
+ Reply-To: $tpl_reply_to
696
700
Subject: $tpl_subject
697
- In-Reply-To: $tpl_reply_to
701
+ In-Reply-To: $tpl_in_reply_to
698
702
699
703
EOT3
700
704
for my $f (@files) {
@@ -733,7 +737,10 @@ sub get_patch_subject {
733
737
$sender = delete($parsed_email{' From' });
734
738
}
735
739
if ($parsed_email{' In-Reply-To' }) {
736
- $initial_reply_to = delete($parsed_email{' In-Reply-To' });
740
+ $initial_in_reply_to = delete($parsed_email{' In-Reply-To' });
741
+ }
742
+ if ($parsed_email{' Reply-To' }) {
743
+ $reply_to = delete($parsed_email{' Reply-To' });
737
744
}
738
745
if ($parsed_email{' Subject' }) {
739
746
$initial_subject = delete($parsed_email{' Subject' });
@@ -916,16 +923,22 @@ sub expand_one_alias {
916
923
@initial_cc = process_address_list(@initial_cc );
917
924
@bcclist = process_address_list(@bcclist );
918
925
919
- if ($thread && !defined $initial_reply_to && $prompting ) {
920
- $initial_reply_to = ask(
926
+ if ($thread && !defined $initial_in_reply_to && $prompting ) {
927
+ $initial_in_reply_to = ask(
921
928
__(" Message-ID to be used as In-Reply-To for the first email (if any)? " ),
922
929
default => " " ,
923
930
valid_re => qr /\@ .*\. / , confirm_only => 1);
924
931
}
925
- if (defined $initial_reply_to ) {
926
- $initial_reply_to =~ s / ^\s *<?// ;
927
- $initial_reply_to =~ s / >?\s *$// ;
928
- $initial_reply_to = " <$initial_reply_to >" if $initial_reply_to ne ' ' ;
932
+ if (defined $initial_in_reply_to ) {
933
+ $initial_in_reply_to =~ s / ^\s *<?// ;
934
+ $initial_in_reply_to =~ s / >?\s *$// ;
935
+ $initial_in_reply_to = " <$initial_in_reply_to >" if $initial_in_reply_to ne ' ' ;
936
+ }
937
+
938
+ if (defined $reply_to ) {
939
+ $reply_to =~ s / ^\s +|\s +$// g ;
940
+ ($reply_to ) = expand_aliases($reply_to );
941
+ $reply_to = sanitize_address($reply_to );
929
942
}
930
943
931
944
if (!defined $smtp_server ) {
@@ -945,7 +958,7 @@ sub expand_one_alias {
945
958
}
946
959
947
960
# Variables we set as part of the loop over files
948
- our ($message_id , %mail , $subject , $reply_to , $references , $message ,
961
+ our ($message_id , %mail , $subject , $in_reply_to , $references , $message ,
949
962
$needs_confirm , $message_num , $ask_default );
950
963
951
964
sub extract_valid_address {
@@ -1354,11 +1367,14 @@ sub send_message {
1354
1367
if ($use_xmailer ) {
1355
1368
$header .= " X-Mailer: git-send-email $gitversion \n " ;
1356
1369
}
1357
- if ($reply_to ) {
1370
+ if ($in_reply_to ) {
1358
1371
1359
- $header .= " In-Reply-To: $reply_to \n " ;
1372
+ $header .= " In-Reply-To: $in_reply_to \n " ;
1360
1373
$header .= " References: $references \n " ;
1361
1374
}
1375
+ if ($reply_to ) {
1376
+ $header .= " Reply-To: $reply_to \n " ;
1377
+ }
1362
1378
if (@xh ) {
1363
1379
$header .= join (" \n " , @xh ) . " \n " ;
1364
1380
}
@@ -1533,8 +1549,8 @@ sub send_message {
1533
1549
return 1;
1534
1550
}
1535
1551
1536
- $reply_to = $initial_reply_to ;
1537
- $references = $initial_reply_to || ' ' ;
1552
+ $in_reply_to = $initial_in_reply_to ;
1553
+ $references = $initial_in_reply_to || ' ' ;
1538
1554
$subject = $initial_subject ;
1539
1555
$message_num = 0;
1540
1556
@@ -1744,9 +1760,9 @@ sub send_message {
1744
1760
1745
1761
# set up for the next message
1746
1762
if ($thread && $message_was_sent &&
1747
- ($chain_reply_to || !defined $reply_to || length ($reply_to ) == 0 ||
1763
+ ($chain_reply_to || !defined $in_reply_to || length ($in_reply_to ) == 0 ||
1748
1764
$message_num == 1)) {
1749
- $reply_to = $message_id ;
1765
+ $in_reply_to = $message_id ;
1750
1766
if (length $references > 0) {
1751
1767
$references .= " \n $message_id " ;
1752
1768
} else {
0 commit comments