0

I am developing an application which enables the user to do a reply via email. However, when a user replies to an email, the original email is also appended to the user's response.

This original email text is being appended in different ways for different clients. For gmail it starts as

On Tue, Jan 4, 2011 at 6:24 PM, User wrote:

Like wise it's different for each client.

Is there any way to identify the original email text from user's reply?

Chaitanya
  • 2,396
  • 4
  • 29
  • 45
  • 1
    You're almost certainly better off using the In-reply-to: header, as it tells you exactly what message they've replied to. As you say, each client is free to quote messages how it wants, and there's no guarantee a reply will contain the original message at all. – Wooble Jan 04 '11 at 13:30

1 Answers1

3

There are three popular ways of tracing the parent of an email message, all done via the message headers rather than the message body.

The In-Reply-To header, when present, should contain the value of the Message-ID header of the parent message.

The References header, when present, should contain a space-separated list containing some of the message-ids of the message's ancestors, ordered from oldest to most recent. The last one in the header should be the value of the Message-ID header of the parent message.

The non-standard Thread-Index header is Microsoft Outlook-specific. When present, it contains a base64-encoded value. If you decode this value, remove the last 5 bytes from the resulting byte array, and re-base64-encode the result, you'll have the value of the Thread-Index header of the parent message -- if the parent had a Thread-Index header.

Community
  • 1
  • 1
dkarp
  • 14,483
  • 6
  • 58
  • 65