Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
this code supposed to wrtie how many mails i have in my mailbox in

   $ServerName = "";

   $UserName = "user";
   $PassWord = "pass";

   $mbox = imap_open($ServerName, $UserName,$PassWord) or die("Could
not open Mailbox - try again later!");

   if ($hdr = imap_check($mbox)) {
    echo "Num Messages " . $hdr->Nmsgs;
   } else {
    echo "failed";

when i used this code at the first time,it wrote exacly how many mail
i have,but every time when i used it again its wrote one mail less.
what the problem??

Re: mail...

hareldo escribió:
Quoted text here. Click to load it

Comments in the PHP manual page for imap_check() say:

"Running this on a mailbox will mark recent/new messages as checked."

"You can prevent imap_check from flagging new/recent messages as checked
by calling imap_open with the "/readonly" or OP_READONLY flags."

-- - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
-- Mi web de humor al baño María:

Re: mail...

the problem was not in the code.there was a problem with the
definitions ofthe mailbox.
now its work.

Site Timeline