Page 1 of 1

number of emails in inbox

Posted: Mon Oct 27, 2008 2:38 pm
by abgoosht
does anyone know how to get the number of emails in the inbox using the imap functions?

Re: number of emails in inbox

Posted: Mon Oct 27, 2008 3:48 pm
by abgoosht
i figured it out in case someone might need this later

Code: Select all

 
<?php
$imap = imap_open($account, $emailuser, $emailpass)
$headers = imap_headers($imap);
$counter=0;
if (!$headers) {
    print "Failed to retrieve headers\n";
    }
else {
    foreach($headers as $header) {
        $counter=$counter+1;
        }
    }
?>
 

Re: number of emails in inbox

Posted: Mon Oct 27, 2008 4:02 pm
by VladSun