Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do all email clients use "In-Reply-To" field in email header?

When any email is send with a Message-ID header, then any replies to it include In-Reply-To naming that ID and References which can name a list of parent message id's, and email clients use this information to construct threads when viewing a list of emails in threaded view.

My question is: Do all email clients (Outlook, Gmail, Exchange, etc) append In-Reply-To field in email header while sending reply to any existing email?

I referred RFC 2822 but it says In-Reply-To field is optional.

Though optional, every message SHOULD have a "Message-ID:" field.
Furthermore, reply messages SHOULD have "In-Reply-To:"

Example of In-Reply-To email header:

First email:

Message-ID <[email protected]>
In-Reply-To: not provided
References: not provided

Second email:

Message-ID <[email protected]>
In-Reply-To: <[email protected]>
References: <[email protected]>

Third email:

Message-ID <[email protected]>
In-Reply-To: <[email protected]>
References: <[email protected]> <[email protected]>
like image 767
slayer Avatar asked Aug 15 '17 09:08

slayer


1 Answers

Arya is correct. I've seen that the majority of email clients/servers do use the In-Reply-To (or more commonly, the References) header(s). Although, it is not required by RFC 2822 standards (as you pointed out).

There are a few ways around this / to work with this. The more you can pull from the email, the more likely it will thread to the correct email chain. I tried to prioritize this matching, and tried something as follows:

  • If the email has an In-Reply-To header, add it to the list of References
  • Use References, if it exists, to match to Message Ids of other emails (in whatever system/code you're working with)
  • If exchanged emails have a certain reference number such as [ref: XXXXXXXXX :ref] (Salesforce formats Email to Case like this by default), you could check for that. Downside is, clients/agents could remove it.
like image 77
Ben Mitchell Avatar answered Sep 29 '22 16:09

Ben Mitchell