Hello,
How will I be able to only get a list of unread messages? I tried changing the following:
$response = $this->write('STATUS "INBOX" (MESSAGES)');
foreach ($response as $line) {
if (preg_match('#^\\s*\\*\\s+STATUS\\s+"?MESSAGES"?\\s+\\((.*)\\)$#', $line, $match)) {
$details = self::parseResponse($match[1], TRUE);
$total_messages = $details['messages'];
}
}
Into:
$response = $this->write('STATUS "INBOX" (UNSEEN)');
foreach ($response as $line) {
if (preg_match('#^\\s*\\*\\s+STATUS\\s+"?INBOX"?\\s+\\((.*)\\)$#', $line, $match)) {
$details = self::parseResponse($match[1], TRUE);
$total_messages = $details['unseen'];
}
}
This returns the amount of UNSEEN messages (in my case 1), but this still returns all of the emails that I have in my mailbox. I assume there should be something changed/added to the FETCH command, but I don't have any experience with IMAP at all.
I hope someone could help me with this :)
Thanks in advance!