PHP imap_search not detecting all messages in gmail inbox
- by Steve
When I run a very simple imap_search on my GMail inbox, the search returns less messages than it should.
Here is the script that anyone with a GMail account can run.
$host = '{imap.gmail.com:993/imap/ssl}';
$user = 'foo';
$pass = 'bar';
$imapStream = imap_open($host,$user,$pass) or die(imap_last_error());
$messages = imap_search($imapStream,"ALL");
echo count($messages);
imap_close($imapStream);
This returns 39 messages. But, I've got 100 messages in my inbox, some in conversations, some forwarded from another account (SquirrelMail, FWIW).
Can anyone duplicate these results, and/or tell me what's going on?
Other server strings I've tried, all returning the same results:
{imap.gmail.com:993/imap/ssl/novalidate-cert}
{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX
{imap.gmail.com:993/imap/ssl}INBOX
GMail's IMAP feature support: http://mail.google.com/support/bin/answer.py?hl=en&answer=78761