public function MailhandlerPhpImapRetrieve::get_unread_messages in Mailhandler 7.2
Same name and namespace in other branches
- 6.2 modules/mailhandler_php_imap/plugins/mailhandler/retrieve/MailhandlerPhpImapRetrieve.class.php \MailhandlerPhpImapRetrieve::get_unread_messages()
Obtain the number of unread messages for an imap stream.
Parameters
object $result: IMAP stream - as opened by imap_open
object $mailbox: The mailbox to retrieve from.
Return value
array IMAP message numbers of unread messages.
1 call to MailhandlerPhpImapRetrieve::get_unread_messages()
- MailhandlerPhpImapRetrieve::retrieve in modules/
mailhandler_php_imap/ plugins/ mailhandler/ retrieve/ MailhandlerPhpImapRetrieve.class.php - Connect to mailbox and run message retrieval.
File
- modules/
mailhandler_php_imap/ plugins/ mailhandler/ retrieve/ MailhandlerPhpImapRetrieve.class.php, line 339 - Definition of MailhandlerPhpImapRetrieve class.
Class
- MailhandlerPhpImapRetrieve
- Retrieve messages using PHP IMAP library.
Code
public function get_unread_messages($result, $mailbox) {
$unread_messages = array();
$number_of_messages = imap_num_msg($result);
for ($i = 1; $i <= $number_of_messages; $i++) {
$header = imap_headerinfo($result, $i);
if ($header->Unseen == 'U' || $header->Recent == 'N') {
$unread_messages[] = $i;
}
}
return $unread_messages;
}