I tried to search for similar questions in SO, and also on the web, but no hits.
tl;dr: What happens in the threading logic when both, references and in-reply-to headers are not available (missing/null)? Is it possible that the email service provider adds these headers to selective messages, and not all?
Background:
I understand that the references headers contain the breadcrumb trail of message-ids, and the in-reply-to headers point to the immediate node in the linked list/thread.
But what happens in the threading logic when both, references and in-reply-to headers are not available (missing/null)? In my case, I am seeing that unrelated messages are ending up in the same thread. For example,
Message 1
in-reply-to: <[email protected]>
references: <[email protected]>
message-id: <trinity-d2cd4e72-@app-gmx-bap21>
Message 2 - no in-reply-to, and references headers
message-id: <[email protected]>
There is no correlation at least from the headers, but these two end up in the same thread. The only common element is the subject line, and it remains unchanged from the root message, in both. All the other messages that have the same subject line, and contain the references and in-reply-to headers get their own separate thread.
Environment:
I am using a shared inbox tool (FrontApp), with a sync-based GMail, not my own code in any way. The tool has its own "de-duplication" logic, but I am unaware if it modifies/trashes the headers. The root message is always sent from our systems - Java Mail via GMail SMTP, and contains a BCC field for internal auditing.
Also, if it helps, I see that this mostly happens in cases when Message 1 is from a GMail/Yahoo accounts, and Message 2 is from either web.de, or gmx.de account.
Do all email from gmx, and web de have these headers missing/null? No, I have evidence of some gmx and web de email that contain these headers, and they are perfectly living in their respective thread, no issues of collision.
Another critical thing is, the issue is not present in GMail itself, when I login into the account, and look at these messages, they are in their own respective thread (each has its own google thread_id).
As per documentation
if they are provided. However, you do not need to provide those parameters to make a message thread.
What is necessary for threading is
subject
needs to matchthreadId
needs to be provided in theRequest body
(however outside of theraw
body).