Search code examples
phpimapreply

Is it possible to count only the total replies message via IMAP()


I'm working on the 1st imap() project. I want to count every message type - unread, read, reply and deleted. Only the "reply" status that consumes me a lot of time. I tried to search here and google. But no luck. Some says I need to create my own way to count it coz there's no such a universal function for it.

So may I have you guys a suggestion on how to count it. Or point me the way to do so. (I don't ask for a complete code. Just only suggestions.)

Regards,


Solution

  • You may look into imap_search

     $sentfolder = "{".$host."}".'SENT'; //sent folder name
     $outbox = imap_open($sentfolder,$username ,$password) or die('Cannot connect to Mail: ' . imap_last_error());
     $sent_msgs = imap_search($outbox, 'ALL'); 
    

    OR:

     // match messages with the \\ANSWERED flag set
    $sent_msgs = imap_search($outbox, 'ANSWERED');