git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] send-email: add --smtp-outlook-id-tweak option

From
Aditya Garg <gargaditya08@live.com>
Date
Apr 28, 2025, 17:57 UTC
Message-ID
<PN3PR01MB9597D897A65B4B59BA6FA93CB8812@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM>
In-Reply-To
<PN3PR01MB9597DA8661D1AFDF4C927A11B8812@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM>

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@pobox.com>
Signed-off-by: Aditya Garg <gargaditya08@live.com>
---
v2: Replace tab with spaces in "outlookidtweak" => \$outlook_id_tweak,
 Documentation/git-send-email.adoc | 14 ++++++++++++++
 git-send-email.perl               | 14 +++++++++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/Documentation/git-send-email.adoc b/Documentation/git-send-email.adoc
index 7f223db42d..20f804e4c7 100644
--- a/Documentation/git-send-email.adoc
+++ b/Documentation/git-send-email.adoc
@@ -153,6 +153,20 @@ Note that no attempts whatsoever are made to validate the encoding.
 Default is the value of the `sendemail.transferEncoding` configuration
 value; if that is unspecified, default to `auto`.
 
+--smtp-outlook-id-tweak=(always|never|auto)::
+	Outlook servers discard the Message-ID sent via email and assign a
+	new random Message-ID, thus breaking threads.
++
+--
+- 'auto' will attempt to retrieve the ID from the server only if the SMTP
+  server is 'smtp.office365.com' or 'smtp-mail.outlook.com'.
+- 'always' will attempt to retrieve the ID from the server irrespective of
+  the SMTP server being used. Use only if Microsoft is your email provider.
+- 'never' will disable this tweak irrespective of theSMTP server being used.
+--
++
+If not specified, the default behaviour will be that of 'auto'.
+
 --xmailer::
 --no-xmailer::
 	Add (or prevent adding) the "X-Mailer:" header.  By default,
diff --git a/git-send-email.perl b/git-send-email.perl
index 618474916e..20cc460ed6 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 <str>  * This server munges Message-ID. Retrieve it from
+                                     the server.
     --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 = 'auto';
 
 my %config_bool_settings = (
     "thread" => \$thread,
@@ -333,6 +336,7 @@ sub do_edit {
     "composeencoding" => \$compose_encoding,
     "transferencoding" => \$target_xfer_encoding,
     "sendmailcmd" => \$sendmail_cmd,
+    "outlookidtweak" => \$outlook_id_tweak,
 );
 
 my %config_path_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=s" => \$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,14 @@ sub gen_header {
 
 sub is_outlook {
 	my ($host) = @_;
-	return ($host eq 'smtp.office365.com' || $host eq 'smtp-mail.outlook.com');
+	if ($outlook_id_tweak eq 'always') {
+		return 1;
+	} elsif ($outlook_id_tweak eq 'never') {
+		return 0;
+	} else {
+		return ($host eq 'smtp.office365.com' ||
+			$host eq 'smtp-mail.outlook.com');
+	}
 }
 
 # Prepares the email, then asks the user what to do.
-- 
2.49.0
Previous: Aditya GargNext: Junio C Hamano
Message 46 of 63 in “send-email: add oauth2 support and fix outlook breaking threads”
  1. 0/3 send-email: add oauth2 support and fix outlook breaking threadsAditya Garg, Apr 23, 2025
  2. 1/3 send-email: implement SMTP bearer authenticationAditya Garg, Apr 23, 2025
  3. Junio C HamanoApr 23, 2025
  4. Aditya GargApr 23, 2025
  5. Greg Kroah-HartmanApr 24, 2025
  6. Aditya GargApr 24, 2025
  7. 2/3 send-email: retrieve Message-ID from outlook SMTP serverAditya Garg, Apr 23, 2025
  8. Junio C HamanoApr 23, 2025
  9. brian m. carlsonApr 23, 2025
  10. Aditya GargApr 24, 2025
  11. 3/3 send-email: add option to generate passswords like OAuth2 tokensAditya Garg, Apr 23, 2025
  12. Junio C HamanoApr 23, 2025
  13. Aditya GargApr 24, 2025
  14. Junio C HamanoApr 24, 2025
  15. M HickfordApr 23, 2025
  16. Aditya GargApr 24, 2025
  17. 0/3 send-email: add oauth2 support and fix outlook breaking threadsAditya Garg, Apr 24, 2025
  18. 1/3 send-email: implement SMTP bearer authenticationAditya Garg, Apr 24, 2025
  19. Julian SwagemakersApr 24, 2025
  20. 2/3 send-email: retrieve Message-ID from outlook SMTP serverAditya Garg, Apr 24, 2025
  21. Greg Kroah-HartmanApr 24, 2025
  22. Yao ZiApr 26, 2025
  23. Aditya GargApr 27, 2025
  24. Yao ZiApr 28, 2025
  25. Aditya GargApr 27, 2025
  26. 3/3 send-email: add option to generate passswords like OAuth2 tokensAditya Garg, Apr 24, 2025
  27. Julian SwagemakersApr 24, 2025
  28. Aditya GargApr 24, 2025
  29. Junio C HamanoApr 24, 2025
  30. Aditya GargApr 24, 2025
  31. Junio C HamanoApr 24, 2025
  32. 0/1 send-email: add oauth2 support and fix outlook breaking threadsAditya Garg, Apr 25, 2025
  33. 1/1 send-email: retrieve Message-ID from outlook SMTP serverAditya Garg, Apr 25, 2025
  34. Aditya GargApr 25, 2025
  35. Erik HuelsmannApr 25, 2025
  36. Junio C HamanoApr 25, 2025
  37. Erik HuelsmannApr 25, 2025
  38. Aditya GargApr 25, 2025
  39. Junio C HamanoApr 25, 2025
  40. Aditya GargApr 25, 2025
  41. Aditya GargApr 26, 2025
  42. Eric SunshineApr 26, 2025
  43. Aditya GargApr 26, 2025
  44. Junio C HamanoApr 28, 2025
  45. send-email: add --smtp-outlook-id-tweak optionAditya Garg, Apr 28, 2025
  46. send-email: add --smtp-outlook-id-tweak optionAditya Garg, Apr 28, 2025
  47. Junio C HamanoApr 28, 2025
  48. Aditya GargApr 29, 2025
  49. send-email: add --[no-]outlook-id-fix optionAditya Garg, Apr 29, 2025
  50. Aditya GargApr 29, 2025
  51. Junio C HamanoApr 29, 2025
  52. Junio C HamanoApr 29, 2025
  53. Aditya GargApr 29, 2025
  54. send-email: add --[no-]outlook-id-fix optionAditya Garg, Apr 29, 2025
  55. Junio C HamanoApr 29, 2025
  56. Aditya GargApr 30, 2025
  57. Aditya GargApr 24, 2025
  58. Erik HuelsmannApr 24, 2025
  59. Julian SwagemakersApr 25, 2025
  60. Aditya GargApr 25, 2025
  61. Aditya GargApr 25, 2025
  62. Erik HulsmannApr 25, 2025
  63. Aditya GargApr 24, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.