note 7871 rejected from function.imap-mailboxmsginfo by didou
| From: | didou@php.net | Date: | Wed, 21 May 2003 15:54:56 +0000 |
| Subject: | note 7871 rejected from function.imap-mailboxmsginfo by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-48744@lists.php.net to get a copy of this message | ||
Note Submitter: eric@otherways.com
----
I tried many ways, it seems only return the information about 'INBOX", anyway because it
only check the current mailbox, then I tried to open another stream for it, but seems in one page
only can open one imap stream, it always return the same result,
I am curious, why not change this function , and let it like the imap_status have more parameters,
then user can tell it which mailbox it should look at.
<?
$server="hostname";
$name="user";
$passwd="passwprd";
$mbox =
imap_open("{".$server."}","$name","$passwd",OP_HALFOPEN) ||
die("can't connect: ".imap_last_error());
$list = imap_getmailboxes($mbox,"{".$server."}","%");
if(is_array($list)) {
reset($list);
while (list($key, $val) = each($list))
{
$folder=$val->name;
$mbox1 =
imap_open("{".$server."}".$folder,"$name","$passwd",OP_HALFOPEN)
|| die("can't connect: ".imap_last_error());
$check = imap_mailboxmsginfo($mbox1);
if($check) {
$messages= $check->Nmsgs;
$recent = $check->Recent;
$unread = $check->Unread;
$size = $check->Size;
echo
"(1)".$folder."|".$messages."|".$recent."|".$unread."|".$size;
}
else {
print "imap_check() failed: ".imap_lasterror(). "<br>\n";
}
imap_close($mbox1);
}
}
else
{
print "imap_getmailboxes failed: ".imap_last_error()."\n";
}
imap_close($mbox);
?>
I got the error:
Warning: Unable to find stream pointer in /home/otherways/htdocs/webmail/test.php on line 14