PHP imap_search not detecting all messages in gmail inbox

Posted by Steve on Stack Overflow See other posts from Stack Overflow or by Steve
Published on 2011-01-06T07:18:36Z Indexed on 2011/01/06 7:53 UTC
Read the original article Hit count: 210

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about php

Related posts about gmail