note 9591 deleted from imap_check by hholzgra
| From: | hholzgra@php.net | Date: | Tue, 14 Nov 2000 07:16:58 +0000 |
| Subject: | note 9591 deleted from imap_check by hholzgra | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-7663@lists.php.net to get a copy of this message | ||
this function is not really useful, because if you
reload the page message will not be listed as "Recent" anymore. So i came up with this
function. You may not like it and yes, i am just a beginner so my code is really bad, but it works
pretty good if there are still any new messages left in the mailbox and it still can give you the
total number of the new messages in the mailbox...
$mbox = imap_open("{localhost:143}INBOX", "$user", "$pass");
$msg_total = imap_num_msg($mbox);
function new_messages($mbox, $msg_total) {
$msg_headers=
imap_fetch_overview($mbox, "1:$msg_total");
$i=0; $new=0; $seen=0;
while ($i<count($msg_headers)){
if ($msg_headers[$i]->seen == "0") {
$new++;
} else {
$seen++;
}
$i++;
}
if ($new == "0") {
echo "There are NO new messages in your mailbox<br>n";
} else {
echo "You have $new new message(s).n";
}
} //end of new_messages();