number of emails in inbox

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
abgoosht
Forum Newbie
Posts: 5
Joined: Sun Oct 26, 2008 8:28 pm

number of emails in inbox

Post by abgoosht »

does anyone know how to get the number of emails in the inbox using the imap functions?
abgoosht
Forum Newbie
Posts: 5
Joined: Sun Oct 26, 2008 8:28 pm

Re: number of emails in inbox

Post 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;
        }
    }
?>
 
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: number of emails in inbox

Post by VladSun »

There are 10 types of people in this world, those who understand binary and those who don't
Post Reply