From: Junio C Hamano <gitster@xxxxxxxxx> Add an option to allow users to specifically enable or disable retrieving the Message-ID from the Outlook SMTP server. This can be 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. Co-authored-by: Aditya Garg <gargaditya08@xxxxxxxx> Signed-off-by: Aditya Garg <gargaditya08@xxxxxxxx> --- Documentation/git-send-email.adoc | 15 +++++++++++++++ git-send-email.perl | 11 ++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Documentation/git-send-email.adoc b/Documentation/git-send-email.adoc index 7f223db42d..8a84fd4342 100644 --- a/Documentation/git-send-email.adoc +++ b/Documentation/git-send-email.adoc @@ -421,6 +421,21 @@ recipient's MUA. `sendemail.mailmap.file` or `sendemail.mailmap.blob` configuration values. Defaults to `sendemail.mailmap`. +--[no-]smtp-outlook-id-tweak:: + Outlook servers discard the Message-ID sent via email and assign a + new random Message-ID, thus breaking threads. ++ +-- +- '--smtp-outlook-id-tweak' 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-smtp-outlook-id-tweak' will disable this tweak irrespective of the + SMTP server being used. +-- ++ +If not sepcified, the default behaviour will be to enable the tweak only if the +SMTP server is 'smtp.office365.com' or 'smtp-mail.outlook.com'. + Administering ~~~~~~~~~~~~~ diff --git a/git-send-email.perl b/git-send-email.perl index 618474916e..0fb3ee98cf 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -60,6 +60,8 @@ sub usage { --smtp-user <str> * Username for SMTP-AUTH. --smtp-pass <str> * Password for SMTP-AUTH; not necessary. --smtp-encryption <str> * tls or ssl; anything else disables. + --smtp-outlook-id-tweak <0|1> * This server munges Message-ID. Retrive it from + the server and assign to \$message_id. --smtp-ssl * Deprecated. Use '--smtp-encryption ssl'. --smtp-ssl-cert-path <str> * Path to ca-certificates (either directory or file). Pass an empty string to disable certificate @@ -290,6 +292,7 @@ sub do_edit { my $mailmap = 0; my $target_xfer_encoding = 'auto'; my $forbid_sendmail_variables = 1; +my $outlook_id_tweak = -1; my %config_bool_settings = ( "thread" => \$thread, @@ -305,6 +308,7 @@ sub do_edit { "xmailer" => \$use_xmailer, "forbidsendmailvariables" => \$forbid_sendmail_variables, "mailmap" => \$mailmap, + "outlookidtweak" => \$outlook_id_tweak, ); my %config_settings = ( @@ -518,6 +522,7 @@ sub config_regexp { "smtp-pass:s" => \$smtp_authpass, "smtp-ssl" => sub { $smtp_encryption = 'ssl' }, "smtp-encryption=s" => \$smtp_encryption, + "smtp-outlook-id-tweak!" => \$outlook_id_tweak, "smtp-ssl-cert-path=s" => \$smtp_ssl_cert_path, "smtp-debug:i" => \$debug_net_smtp, "smtp-domain:s" => \$smtp_domain, @@ -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_tweak < 0) { + $outlook_id_tweak = + ($host eq 'smtp.office365.com' || + $host eq 'smtp-mail.outlook.com') ? 1 : 0; + } return $outlook_id_tweak; } # Prepares the email, then asks the user what to do. -- 2.49.0 ------ If you want I can officially submit this as well. Would also have to add your Signed-off-by? Cheers! Aditya