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. Helped-by: Junio C Hamano <gitster@xxxxxxxxx> Signed-off-by: Aditya Garg <gargaditya08@xxxxxxxx> --- v2: Replace tab with spaces in "outlookidtweak" => \$outlook_id_tweak, v3: Rename to --[no-]outlook-id-fix and make it bool. Also add missing * in description of --no-smtp-auth. Documentation/git-send-email.adoc | 15 +++++++++++++++ git-send-email.perl | 13 +++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Documentation/git-send-email.adoc b/Documentation/git-send-email.adoc index 7f223db42d..5760248893 100644 --- a/Documentation/git-send-email.adoc +++ b/Documentation/git-send-email.adoc @@ -115,6 +115,21 @@ illustration below where `[PATCH v2 0/3]` is in reply to `[PATCH 0/2]`: Only necessary if --compose is also set. If --compose is not set, this will be prompted for. +--[no-]outlook-id-fix:: + Outlook servers discard the Message-ID sent via email and assign a + new random Message-ID, thus breaking threads. ++ +-- +- '--outlook-id-fix' will attempt to retrieve the ID from the server + irrespective of the SMTP server being used. Use only if Microsoft is your + email provider. +- '--no-outlook-id-fix' will disable this tweak irrespective of the SMTP + server being used. +-- ++ +If not specified, the default behaviour will be to enable the tweak only if the +SMTP server is 'smtp.office365.com' or 'smtp-mail.outlook.com'. + --subject=<string>:: Specify the initial subject of the email thread. Only necessary if --compose is also set. If --compose diff --git a/git-send-email.perl b/git-send-email.perl index 618474916e..ed707bfa46 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -41,6 +41,8 @@ sub usage { --subject <str> * Email "Subject:" --reply-to <str> * Email "Reply-To:" --in-reply-to <str> * Email "In-Reply-To:" + --[no-]outlook-id-fix * This server munges Message-ID. Retrieve it from + the server. --[no-]xmailer * Add "X-Mailer:" header (default). --[no-]annotate * Review each patch that will be sent in an editor. --compose * Open an editor for introduction. @@ -68,7 +70,7 @@ sub usage { --smtp-auth <str> * Space-separated list of allowed AUTH mechanisms, or "none" to disable authentication. This setting forces to use one of the listed mechanisms. - --no-smtp-auth Disable SMTP authentication. Shorthand for + --no-smtp-auth * Disable SMTP authentication. Shorthand for `--smtp-auth=none` --smtp-debug <0|1> * Disable, enable Net::SMTP debug. @@ -290,6 +292,7 @@ sub do_edit { my $mailmap = 0; my $target_xfer_encoding = 'auto'; my $forbid_sendmail_variables = 1; +my $outlook_id_fix = 'auto'; my %config_bool_settings = ( "thread" => \$thread, @@ -305,6 +308,7 @@ sub do_edit { "xmailer" => \$use_xmailer, "forbidsendmailvariables" => \$forbid_sendmail_variables, "mailmap" => \$mailmap, + "outlookidfix" => \$outlook_id_fix, ); my %config_settings = ( @@ -551,6 +555,7 @@ sub config_regexp { "relogin-delay=i" => \$relogin_delay, "git-completion-helper" => \$git_completion_helper, "v=s" => \$reroll_count, + "outlook-id-fix!" => \$outlook_id_fix, ); $rc = GetOptions(%options); @@ -1576,7 +1581,11 @@ sub gen_header { sub is_outlook { my ($host) = @_; - return ($host eq 'smtp.office365.com' || $host eq 'smtp-mail.outlook.com'); + if ($outlook_id_fix eq 'auto') { + $outlook_id_fix = + ($host eq 'smtp.office365.com' || + $host eq 'smtp-mail.outlook.com') ? 1 : 0; + } return $outlook_id_fix; } # Prepares the email, then asks the user what to do. -- 2.49.0