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

[PATCH v7 2/2] send-email: show the new message id assigned by outlook in the logs

From
Aditya Garg <gargaditya08@live.com>
Date
Jun 4, 2025, 12:55 UTC
Message-ID
<PN3PR01MB95979A02866CF1AD640E48ADB86CA@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM>
In-Reply-To
<PN3PR01MB95979AA8114CA26405BE02CFB86CA@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM>

Whenever an email is sent, send-email shows a log at last, which contains all the headers of the email that were received by the receipients.

In case outlook changes the Message-ID, a log for the same is shown to the user, but that change is not reflected when the log containing all the headers is displayed. Here is an example of the log that is shown when outlook changes the Message-ID:

Outlook reassigned Message-ID to: <PN3PR01MB95973E5ACD7CCFADCB4E298CB865A@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM>
OK. Log says:
Server: smtp.office365.com
MAIL FROM:<gargaditya08@live.com>
RCPT TO:<negahe7142@nomrista.com>
From: Aditya Garg <gargaditya08@live.com>
To: negahe7142@nomrista.com
Subject: [PATCH] send-email: show the new message id assigned by outlook in the logs
Date: Mon, 26 May 2025 20:28:36 +0530
Message-ID: <20250526145836.4825-1-gargaditya08@live.com>
X-Mailer: git-send-email @GIT_VERSION@
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Result: 250

Fix this by updating the $header variable, which has the message ID we internally assigned on the "Message-ID:" header, with the message ID the Outlook server assigned. It should look like this after this patch:

OK. Log says:
Server: smtp.office365.com
MAIL FROM:<gargaditya08@live.com>
RCPT TO:<negahe7142@nomrista.com>
From: Aditya Garg <gargaditya08@live.com>
To: negahe7142@nomrista.com
Subject: [PATCH] send-email: show the new message id assigned by outlook in the logs
Date: Mon, 26 May 2025 20:29:22 +0530
Message-ID: <PN3PR01MB95977486061BD2542BD09B67B865A@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM>
X-Mailer: git-send-email @GIT_VERSION@
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Result: 250
Signed-off-by: Aditya Garg <gargaditya08@live.com>
---
 git-send-email.perl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index ac1d5b7070..175b0c184b 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1774,7 +1774,8 @@ sub send_message {
 		if (is_outlook($smtp_server)) {
 			if ($smtp->message =~ /<([^>]+)>/) {
 				$message_id = "<$1>";
-				printf __("Outlook reassigned Message-ID to: %s\n"), $message_id;
+				$header =~ s/^(Message-ID:\s*).*\n/${1}$message_id\n/m;
+				printf __("Outlook reassigned Message-ID to: %s\n"), $message_id if $smtp->debug;
 			} else {
 				warn __("Warning: Could not retrieve Message-ID from server response.\n");
 			}
-- 
2.49.0.windows.1
Previous: Aditya GargNext: Aditya Garg
Message 12 of 14 in “send-email: fix threads breaking in case user edits emails and improvements to outlook ID fix.”
  1. 0/2 send-email: fix threads breaking in case user edits emails and improvements to outlook ID fix.Aditya Garg, May 26, 2025
  2. 1/2 send-email: fix bug resulting in increased message number if a message is editedAditya Garg, May 26, 2025
  3. 2/2 send-email: show the new message id assigned by outlook in the logsAditya Garg, May 26, 2025
  4. 0/2 send-email: fix threads breaking in case user edits emails and improvements to outlook ID fix.Aditya Garg, May 29, 2025
  5. 1/2 send-email: fix bug resulting in broken threads if a message is editedAditya Garg, May 29, 2025
  6. 2/2 send-email: show the new message id assigned by outlook in the logsAditya Garg, May 29, 2025
  7. Junio C HamanoMay 29, 2025
  8. Aditya GargMay 29, 2025
  9. Junio C HamanoJun 4, 2025
  10. Aditya GargJun 4, 2025
  11. 0/2 send-email: fix threads breaking in case user edits emails and improvements to outlook ID fix.Aditya Garg, Jun 4, 2025
  12. 2/2 send-email: show the new message id assigned by outlook in the logsAditya Garg, Jun 4, 2025
  13. 1/2 send-email: fix bug resulting in broken threads if a message is editedAditya Garg, Jun 4, 2025
  14. Junio C HamanoJun 4, 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.