slayer
slayer

Reputation: 445

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. So email clients can 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 when replying 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]>

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]>

Upvotes: 20

Views: 28482

Answers (2)

U. Windl
U. Windl

Reputation: 4325

The short answer "no" given is most likely correct, but I want to point out why that might be so:

First the current specification is RFC 5322: Internet Message Format, dated October 2008, and the correct phrase is "header field".

The SHOULD specification for Message-ID, In_Reply-To and References was used instead of MUST, because those header fields are not technically necessary for successful email message exchange (see also RFC 2119: Key words for use in RFCs to Indicate Requirement Levels).

Also there are very poor email clients, specifically when sending automated messages, that create rather minimalistic header fields. So the MTAs (Message Transfer Agents) like sendmail can be configured to add missing header fields like Message-ID or Date, but they won't add In-Reply-To or References, because the MTA actually cannot know in general. Actually the MSA (Message Submission Agent) receiving the initial message should do that, but historically the MTAs also were MSAs.

Still, while not technically necessary, RFC 2119 clearly says about SHOULD:

This word, or the adjective "RECOMMENDED", mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.

Back in 1985 or so there was an open source "graphical" (i.e.: TUI (Terminal User Interface)) email program (MUA, Mail User Agent) named "ELM" (by Dave Taylor, HP at that time) that supported the "In-Reply-To" header field, so actually there is little excuse for modern programs not to do.

Upvotes: 3

Ben Mitchell
Ben Mitchell

Reputation: 101

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.

Upvotes: 10

Related Questions