title: PHP Displaying unread mail count
body: <p>I am using php imap class.
  In my box I have a lot of mail, but with this script I would retrieve only the unreaded mail.
  How can I do it?</p>
  
  <pre><code>if ($mbox=imap_open( "{" . $mailserver . ":" . $port . "}INBOX", $user, $pass )) 
  {
    echo "Connected\n"; 
  } else { exit ("Can't connect: " . imap_last_error() ."\n");  echo "FAIL!\n";  }; 
  
  if ($hdr = imap_check($mbox)) {
    $msgCount = $hdr-&gt;Nmsgs;
    echo "Ci sono ".$msgCount." mail";
  } else {
    echo "Failed to get mail";
  }
  </code></pre>
  
  <p>If I do</p>
  
  <pre><code>$overview=imap_fetch_overview($mbox,"1:$msgCount",0);
  </code></pre>
  
  <p>the script load to an infinity time.</p>
  
  <p>The imap_search UNSEEN solution is not good because pop3 don't use this flag.
  So how can I do??????
  Thanks a lot.</p>