Search code examples
javaemailimapoutlook-restapi

Email IMAP mails Fetching


When I fetch mails from Third party, my requirement is group this mails in in single thread as per the ThreadId.In case of Gmail I am using GIMAP. It has a method ThreadId which gives ThreadId. But in case of other Service Providers like Ymail, Outlook I am not getting any API to get ThreadId.

PS: I don't want to use REST API's


Solution

  • You won't get ThreadID (X-GM-THRID) because it is not default implementation in IMAP. Its an extension item that Google have implemented along with LABELS (X-GM-LABELS) and MSGID (X-GM-MSGID)

    You will have to figure out yourself of getting complete email conversation. There are 2 algorithms to do this. 1st approach is by using "in-Reply-to" field. 2nd approach is a little complex and is based on References.

    This link has details on email threading.