Kumar
Kumar

Reputation: 11369

How to code for grouping email in conversations

...similar to gmail !

Now it's easy enough to lump them together when the subject is (almost) same with additional prefixes ( re:, re: re:, ... ) perhaps

but you can include additional people when you reply etc. and they do show up in the original "conversation" thread

i haven't looked at the headers in a while but wondering if there are additional X-?????? headers that're being used or are part of some RFC/convention somewhere

any sample/example code that already does this would be great of course!

Upvotes: 8

Views: 4124

Answers (3)

Khez
Khez

Reputation: 10350

Well, it all depends on how you save some of the data.

Email Headers already offer you:

Message-ID: Also an automatically generated field; used to prevent multiple delivery and for reference in In-Reply-To: (see below).

In-Reply-To: Message-ID of the message that this is a reply to. Used to link related messages together. This field only applies for reply messages.

Which can be used to link subsequent emails into a conversation group.

Upvotes: 10

jgauffin
jgauffin

Reputation: 101150

Here is an algorithm: http://www.jwz.org/doc/threading.html

Upvotes: 8

Stefan
Stefan

Reputation: 11519

Im sure the most programs embedds metadata to the message so it can be tracked back to the original message when a reply is comming back. Anything other would be like guessing and as you point out, only subject and to/from is'nt going to cut it.

Outlook for example embeds thread-Index and Message-ID as metadata in the message wich can be used to track conversations between users no mather if other receivers are added later on in the conversation:

> Thread-Index: AcvvoZr5wUUl1mneRmCpi5P/XCjYWQ==  
> Message-ID: <[email protected]>

Upvotes: 4

Related Questions