array imap_thread ( resource $imap_stream [, int $options = SE_FREE ] )
Gets a tree of a threaded message.
imap_thread() returns an associative array containing a tree of messages threaded by REFERENCES, or FALSE on error. Every message in the current mailbox will be represented by three entries in the resulting array: $thread["XX.num"] - current message number $thread["XX.next"] $thread["XX.branch"]