Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This was a tough one on Google: <code>php imap unread</code></p> <p>The first result:</p> <ul> <li><a href="http://www.electrictoolbox.com/php-imap-unread-messages/" rel="nofollow">http://www.electrictoolbox.com/php-imap-unread-messages/</a></li> </ul> <blockquote> <p>There's a flag called UNSEEN which you can use to search for the unread emails. You would call the imap_search function with the UNSEEN flag like so: view sourceprint?</p> </blockquote> <pre><code> $result = imap_search($connection, 'UNSEEN'); </code></pre> <blockquote> <p>If you need to combine this with more search flags, for example searching for messages from me@example.com, you could do this: view sourceprint?</p> </blockquote> <pre><code> $result = imap_search($connection, 'UNSEEN FROM "me@example.com"'); </code></pre> <blockquote> <p>For a complete list of the available flags, refer to the criteria section of the imap_search manual page on the PHP website (www.php.net/imap_search)</p> </blockquote> <p><strong>Edit</strong> I had read this originally as IMAP. #fail.</p> <p>Google: <code>php pop3 unread</code></p> <p>2nd link:</p> <pre><code> function CountUnreadMails($host, $login, $passwd) { $mbox = imap_open("{{$host}/pop3:110}", $login, $passwd); $count = 0; if (!$mbox) { echo "Error"; } else { $headers = imap_headers($mbox); foreach ($headers as $mail) { $flags = substr($mail, 0, 4); $isunr = (strpos($flags, "U") !== false); if ($isunr) $count++; } } imap_close($mbox); return $count; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload