Closed matiux closed 7 years ago
I figured out that the problem is Gmail. With my personal domain / email, the count works well .. Some idea?
This error usually occurs when the message id is not valid. This method is very simple, there can be no mistakes.
public function countMessages()
{
return imap_num_msg($this->imap);
}
http://php.net/manual/en/function.imap-num-msg.php
BUT all imap servers have different implementation. And they may not correctly work with imap_num_msg().
Try to use imap_status() and pull out the number of messages from there.
imap_status ( resource $imap_stream , string $mailbox , int $options )
http://php.net/manual/en/function.imap-status.php
$status = imap_status($mbox, "{imap.example.org}INBOX", SA_ALL);
if ($status) {
echo "Messages: " . $status->messages . "<br />\n";
echo "Recent: " . $status->recent . "<br />\n";
echo "Unseen: " . $status->unseen . "<br />\n";
echo "UIDnext: " . $status->uidnext . "<br />\n";
echo "UIDvalidity:" . $status->uidvalidity . "<br />\n";
} else {
echo "imap_status failed: " . imap_last_error() . "\n";
}
@matiux is this still an issue?
I assume we good here :D
Hi, I have read issue #92 but I have no warnings.. I have only wrong number of messages when call $imapClient->countMessages()