Skip to content

Commit daec3c0

Browse files
AdityaGarg8gitster
authored andcommitted
send-email: add --[no-]outlook-id-fix option
Add an option to allow users to specifically enable or disable retrieving the Message-ID from the Outlook SMTP server. This can be used for other hosts mimicking the behaviour of Outlook, or for users who set a custom domain to be a CNAME for the Outlook SMTP server. While at it, lets also add missing * in description of --no-smtp-auth. Helped-by: Junio C Hamano <[email protected]> Signed-off-by: Aditya Garg <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d235c46 commit daec3c0

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

Documentation/git-send-email.adoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,19 @@ illustration below where `[PATCH v2 0/3]` is in reply to `[PATCH 0/2]`:
115115
Only necessary if --compose is also set. If --compose
116116
is not set, this will be prompted for.
117117

118+
--[no-]outlook-id-fix::
119+
Microsoft Outlook SMTP servers discard the Message-ID sent via email and
120+
assign a new random Message-ID, thus breaking threads.
121+
+
122+
With `--outlook-id-fix`, 'git send-email' uses a mechanism specific to
123+
Outlook servers to learn the Message-ID the server assigned to fix the
124+
threading. Use it only when you know that the server reports the
125+
rewritten Message-ID the same way as Outlook servers do.
126+
+
127+
Without this option specified, the fix is done by default when talking
128+
to 'smtp.office365.com' or 'smtp-mail.outlook.com'. Use
129+
`--no-outlook-id-fix` to disable even when talking to these two servers.
130+
118131
--subject=<string>::
119132
Specify the initial subject of the email thread.
120133
Only necessary if --compose is also set. If --compose

git-send-email.perl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ sub usage {
4141
--subject <str> * Email "Subject:"
4242
--reply-to <str> * Email "Reply-To:"
4343
--in-reply-to <str> * Email "In-Reply-To:"
44+
--[no-]outlook-id-fix * The SMTP host is an Outlook server that munges the
45+
Message-ID. Retrieve it from the server.
4446
--[no-]xmailer * Add "X-Mailer:" header (default).
4547
--[no-]annotate * Review each patch that will be sent in an editor.
4648
--compose * Open an editor for introduction.
@@ -68,7 +70,7 @@ sub usage {
6870
--smtp-auth <str> * Space-separated list of allowed AUTH mechanisms, or
6971
"none" to disable authentication.
7072
This setting forces to use one of the listed mechanisms.
71-
--no-smtp-auth Disable SMTP authentication. Shorthand for
73+
--no-smtp-auth * Disable SMTP authentication. Shorthand for
7274
`--smtp-auth=none`
7375
--smtp-debug <0|1> * Disable, enable Net::SMTP debug.
7476
@@ -290,6 +292,7 @@ sub do_edit {
290292
my $mailmap = 0;
291293
my $target_xfer_encoding = 'auto';
292294
my $forbid_sendmail_variables = 1;
295+
my $outlook_id_fix = 'auto';
293296

294297
my %config_bool_settings = (
295298
"thread" => \$thread,
@@ -305,6 +308,7 @@ sub do_edit {
305308
"xmailer" => \$use_xmailer,
306309
"forbidsendmailvariables" => \$forbid_sendmail_variables,
307310
"mailmap" => \$mailmap,
311+
"outlookidfix" => \$outlook_id_fix,
308312
);
309313

310314
my %config_settings = (
@@ -551,6 +555,7 @@ sub config_regexp {
551555
"relogin-delay=i" => \$relogin_delay,
552556
"git-completion-helper" => \$git_completion_helper,
553557
"v=s" => \$reroll_count,
558+
"outlook-id-fix!" => \$outlook_id_fix,
554559
);
555560
$rc = GetOptions(%options);
556561

@@ -1576,7 +1581,12 @@ sub gen_header {
15761581

15771582
sub is_outlook {
15781583
my ($host) = @_;
1579-
return ($host eq 'smtp.office365.com' || $host eq 'smtp-mail.outlook.com');
1584+
if ($outlook_id_fix eq 'auto') {
1585+
$outlook_id_fix =
1586+
($host eq 'smtp.office365.com' ||
1587+
$host eq 'smtp-mail.outlook.com') ? 1 : 0;
1588+
}
1589+
return $outlook_id_fix;
15801590
}
15811591

15821592
# Prepares the email, then asks the user what to do.

0 commit comments

Comments
 (0)