public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste•net>
To: Aditya Garg <gargaditya08@live•com>
Cc: Julian Swagemakers <julian@swagemakers•org>,
	git@vger•kernel.org, Junio C Hamano <gitster@pobox•com>,
	M Hickford <mirth.hickford@gmail•com>,
	Shengyu Qu <wiagn233@outlook•com>
Subject: Re: [PATCH v4 2/3] send-email: retrieve Message-ID from outlook SMTP server
Date: Wed, 23 Apr 2025 22:52:52 +0000	[thread overview]
Message-ID: <aAlvRBDVygspE5_0@tapette.crustytoothpaste.net> (raw)
In-Reply-To: <PN3PR01MB9597EFFF817F0FD3D8B3772DB8BA2@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM>

[-- Attachment #1: Type: text/plain, Size: 2348 bytes --]

On 2025-04-23 at 12:19:46, Aditya Garg wrote:
> This is a problem because the Message-ID is crucial when we are sending
> multiple emails in a thread. The current implementation for threads in
> the script replies to the Message-ID it generated, but due to Outlook's
> behavior, it is not the same as the one that the recipient got, thus
> breaking threads. So a need arises to retrieve the Message-ID from the
> server response and set it in the In-Reply-To and References email
> headers instead of using the self generated one for the purpose of
> replies.

This behaviour is allowed by the standard.  It's not uncommon for
smarthosts to replace the Message-ID header because they are responsible
for making it unique.

I certainly don't love it and it has the possibility to break lots of
things, as this patch demonstrates, but it is technically allowed.

> The $smtp->message variable in this script for outlook is something like
> this:
> 
> 2.0.0 OK <Message-ID> [Hostname=Some-hostname]
> 
> The Message-ID here is the one the receipient gets, rather than the one
> the script generated.

"recipient"

> diff --git a/git-send-email.perl b/git-send-email.perl
> index a6cafda29c..a18e978e22 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -1636,6 +1636,11 @@ sub gen_header {
>  	return ($recipients_ref, $to, $date, $gitversion, $cc, $ccline, $header);
>  }
>  
> +sub is_outlook {
> +	my ($host) = @_;
> +	return ($host eq 'smtp.office365.com' || $host eq 'smtp-mail.outlook.com');
> +}

Are we certain that these are the only two possible values for this?  My
worry is that we'll have some other host (or the same host with some
other hostname) that does the same thing and then they'll have the same
problem.  For instance, if I set my domain `smtp-outlook.example.com` to
be a CNAME for `smtp.office365.com`, then this would fail and I'm
concerned that we'll have corporate environments with that
configuration.

What I would recommend here is that instead we set an option that
controls the message ID generation.  We might have "as-is" for the
default behaviour, "auto" to use the `is_outlook` function above to
guess, and something like "data-response" to always use the approach
you've written below.
-- 
brian m. carlson (they/them)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 325 bytes --]

  parent reply	other threads:[~2025-04-23 22:53 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-23 12:19 [PATCH v4 0/3] send-email: add oauth2 support and fix outlook breaking threads Aditya Garg
2025-04-23 12:19 ` [PATCH v4 1/3] send-email: implement SMTP bearer authentication Aditya Garg
2025-04-23 18:04   ` Junio C Hamano
2025-04-23 18:33     ` Aditya Garg
2025-04-24  6:36       ` Greg Kroah-Hartman
2025-04-24  8:23         ` Aditya Garg
2025-04-23 12:19 ` [PATCH v4 2/3] send-email: retrieve Message-ID from outlook SMTP server Aditya Garg
2025-04-23 18:54   ` Junio C Hamano
2025-04-23 22:52   ` brian m. carlson [this message]
2025-04-24  3:42     ` Aditya Garg
2025-04-23 12:19 ` [PATCH v4 3/3] send-email: add option to generate passswords like OAuth2 tokens Aditya Garg
2025-04-23 19:03   ` Junio C Hamano
2025-04-24  3:29     ` Aditya Garg
2025-04-24 12:43       ` Junio C Hamano
2025-04-23 20:50 ` [PATCH v4 0/3] send-email: add oauth2 support and fix outlook breaking threads M Hickford
2025-04-24  3:44   ` Aditya Garg
2025-04-24  7:53 ` [PATCH v5 " Aditya Garg
2025-04-24  7:53   ` [PATCH v5 1/3] send-email: implement SMTP bearer authentication Aditya Garg
2025-04-24 12:12     ` Julian Swagemakers
     [not found]     ` <CACOoB6jE=DgpYYaudhqTVDRd2SCz++aog7QYwTQs6-MAD8dBuw@mail.gmail.com>
2025-04-24 18:22       ` Aditya Garg
2025-04-24 19:20         ` Erik Huelsmann
2025-04-25  6:19         ` Julian Swagemakers
2025-04-25  6:25           ` Aditya Garg
2025-04-25  9:45           ` Aditya Garg
2025-04-25 10:17             ` Erik Hulsmann
2025-04-24 18:23       ` Aditya Garg
2025-04-24  7:53   ` [PATCH v5 2/3] send-email: retrieve Message-ID from outlook SMTP server Aditya Garg
2025-04-24 13:09     ` Greg Kroah-Hartman
2025-04-26 18:11       ` Yao Zi
2025-04-27 20:05         ` Aditya Garg
2025-04-28  4:16           ` Yao Zi
2025-04-27 19:44       ` Aditya Garg
2025-04-24  7:53   ` [PATCH v5 3/3] send-email: add option to generate passswords like OAuth2 tokens Aditya Garg
2025-04-24 12:28     ` Julian Swagemakers
2025-04-24 12:53       ` Aditya Garg
2025-04-24 15:20         ` Junio C Hamano
2025-04-24 15:46           ` Aditya Garg
2025-04-24 16:58             ` Junio C Hamano
2025-04-25 10:09 ` [PATCH v6 0/1] send-email: add oauth2 support and fix outlook breaking threads Aditya Garg
2025-04-25 10:09   ` [PATCH v6 1/1] send-email: retrieve Message-ID from outlook SMTP server Aditya Garg
2025-04-25 15:04     ` Aditya Garg
2025-04-25 16:22       ` Erik Huelsmann
2025-04-25 17:08         ` Junio C Hamano
2025-04-25 19:05           ` Erik Huelsmann
2025-04-25 19:08             ` Aditya Garg
2025-04-25 17:23     ` Junio C Hamano
2025-04-25 19:05       ` Aditya Garg
2025-04-26  8:36       ` Aditya Garg
2025-04-26  9:03         ` Eric Sunshine
2025-04-26 17:40           ` Aditya Garg
2025-04-28 16:52         ` Junio C Hamano
2025-04-28 17:52           ` [PATCH] send-email: add --smtp-outlook-id-tweak option Aditya Garg
2025-04-28 17:57             ` [PATCH v2] " Aditya Garg
2025-04-28 20:47               ` Junio C Hamano
2025-04-29  3:44                 ` Aditya Garg
2025-04-29 10:52             ` [PATCH v3] send-email: add --[no-]outlook-id-fix option Aditya Garg
2025-04-29 11:00               ` Aditya Garg
2025-04-29 15:57               ` Junio C Hamano
2025-04-29 16:24               ` Junio C Hamano
2025-04-29 16:26                 ` Aditya Garg
2025-04-29 16:37             ` [PATCH v4] " Aditya Garg
2025-04-29 23:08               ` Junio C Hamano
2025-04-30  8:31                 ` Aditya Garg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aAlvRBDVygspE5_0@tapette.crustytoothpaste.net \
    --to=sandals@crustytoothpaste$(echo .)net \
    --cc=gargaditya08@live$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=julian@swagemakers$(echo .)org \
    --cc=mirth.hickford@gmail$(echo .)com \
    --cc=wiagn233@outlook$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox