Skip to content

Commit c01e1f0

Browse files
AdityaGarg8gitster
authored andcommitted
send-email: show the new message id assigned by outlook in the logs
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:<[email protected]> RCPT TO:<[email protected]> From: Aditya Garg <[email protected]> To: [email protected] 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: <[email protected]> X-Mailer: git-send-email @GIT_VERSION@ MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Result: 250 This patch fixes this by modifying the $header variable, which is responsible for showing the logs at the end. Also, the log which states that the Message-ID has been changed will now be shown only when smtp-debug is enabled, since the main log having all of the headers is anyways displaying the new Message-ID. It should look like this after this patch: OK. Log says: Server: smtp.office365.com MAIL FROM:<[email protected]> RCPT TO:<[email protected]> From: Aditya Garg <[email protected]> To: [email protected] 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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f282c7b commit c01e1f0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

git-send-email.perl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1788,7 +1788,9 @@ sub send_message {
17881788
if (is_outlook($smtp_server)) {
17891789
if ($smtp->message =~ /<([^>]+)>/) {
17901790
$message_id = "<$1>";
1791-
printf __("Outlook reassigned Message-ID to: %s\n"), $message_id;
1791+
# Replace the original Message-ID in $header with the new one
1792+
$header =~ s/^(Message-ID:\s*).*\n/${1}$message_id\n/m;
1793+
printf __("Outlook reassigned Message-ID to: %s\n"), $message_id if $smtp->debug;
17921794
} else {
17931795
warn __("Warning: Could not retrieve Message-ID from server response.\n");
17941796
}

0 commit comments

Comments
 (0)