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 an开发者_JAVA百科y 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.
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.
Years old, but:
The unsatisfying answer is: you can't --- IMAP only knows about messages, not threads, so you can only get thread information by looking at all the messages and aggregating.that.
What you can do is to fetch just the UID and X-GM-THRID fields, which is fast (about 40 bytes or so per message). Then you find the first message for each thread, then use UID FETCH to pull just those. By not fetching the entire message envelope until you know which messages to fetch you save a lot of bandwidth.
精彩评论