Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GMail IMAP - How to get conversations (threads) list?

I am trying create similar view like in GMail. I know that GMail IMAP have extension X-GM-THRID which I can use in FETCH command, but this return me this same numbers of items and I must group them manually by thread ID. Exists any faster way to group this? I am mean, can google imap server return me list of messages grouped by thread id (like in gmail web interface)? To be more specific:

If I have this list (THREAD ID | TEXT)

  • 12345 "hello"
  • 12345 "hi"
  • 12345 "what's up?"
  • 67890 "are you there?"
  • 67890 "no, I'm not"

I want get from server only:

  • 12345 "hello"
  • 67890 "are you there?"

Can I do that? Finally, I would have to group this by my self, but this solution is inefficient and slow (I have many messages to group)

Regards and sorry for my English.

like image 772
Dibo Avatar asked May 22 '11 15:05

Dibo


1 Answers

The 'In-Reply-To' header of the child should have the value of the Message-Id header of the parent.

There is one another field in header 'References' which contains message ids of all its parent.

you can user either of them as per your requirement.

like image 76
Avadhesh Avatar answered Sep 25 '22 16:09

Avadhesh