PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

imap_mime_header_decode> <imap_mail
Last updated: Fri, 03 Oct 2008

view this page in

imap_mailboxmsginfo

(PHP 4, PHP 5)

imap_mailboxmsginfoLit les informations à propos de la boîte aux lettres courante

Description

object imap_mailboxmsginfo ( resource $imap_stream )

imap_mailboxmsginfo() vérifie le statut courant de la boîte aux lettres sur le serveur. C'est similaire à l'utilisation de la fonction imap_status(), mais fournie également la taille totale des messages de la boîte aux lettres, ce qui demande un peu plus de temps à l'exécution.

Liste de paramètres

imap_stream

Un flux IMPA retourné par la fonction imap_open().

Valeurs de retour

Retourne un objet avec les propriétés suivantes :

Propriétés de boîte aux lettres
Date Date de dernière modification du contenu de la boîte aux lettres
Driver Pilote
Mailbox Nom de la boîte aux lettres
Nmsgs Nombre de messages
Recent Nombre de messages récents
Unread Nombre de messages non lus
Deleted Nombre de messages effacés
Size Taille de la boîte aux lettres

Retourne FALSE si une erreur survient.

Exemples

Exemple #1 Exemple avec imap_mailboxmsginfo()

<?php

$mbox 
imap_open("{imap.example.org}INBOX""username""password")
      or die(
"Connexion impossible : " imap_last_error());

$check imap_mailboxmsginfo($mbox);

if (
$check) {
    echo 
"Date : "     $check->Date    "<br />\n" ;
    echo 
"Pilote : "   $check->Driver  "<br />\n" ;
    echo 
"Boîte aux lettres : "  $check->Mailbox "<br />\n" ;
    echo 
"Messages : " $check->Nmsgs   "<br />\n" ;
    echo 
"Récent : "   $check->Recent  "<br />\n" ;
    echo 
"Non lu : "   $check->Unread  "<br />\n" ;
    echo 
"Effacé : "  $check->Deleted "<br />\n" ;
    echo 
"Taille : "     $check->Size    "<br />\n" ;
} else {
    echo 
"imap_check() a échoué : " imap_last_error() . "<br />\n";
}

imap_close($mbox);

?>



imap_mime_header_decode> <imap_mail
Last updated: Fri, 03 Oct 2008
 
add a note add a note User Contributed Notes
imap_mailboxmsginfo
Maxg
30-Aug-2004 11:41
About the slowness of imap_mailboxmsginfo() : if used on an IMAP connection, I did checked my mailserver logs and it appeared to send FETCH commands to retrieve the headers of EVERY messages of the mailbox ...
So, if you have, let's say, 400 messages in a folder, the function will be very slow (>1.5 sec on a local server !) ...

I strongly advise you to use imap_status() instead, which only sends one < STATUS "Mailbox/Name" (MESSAGES UNSEEN) > and is actually a lot faster (at least with IMAP, but that's maybe not true with POP3)
m at tacker dot org
12-Mar-2003 10:55
The runtime difference between imap_status and imap_mailboxmsginfo is very significant on large mailboxes

<?php

/** opening connection to a
   * mailbox with 3987 messages
   * and retrive status information **/
$mbox = imap_open ('{mail.somwhere.com:110}', $user, $password);

$mbox_info = imap_status($mbox, '{mail.somwhere.com:110}INBOX', SA_MESSAGES);
/** took 11.05 seconds **/

$mbox_info = imap_mailboxmsginfo($mbox);
/** took 6 minutes 5.382 seconds **/

?>
til_roque at yahoo dot com
03-Mar-2003 11:13
the 'recent' of this function returns the same as 'UIDvalidity' from imap_status() ... makes no sense (or dos it?)
js at jerntorget dot se, ej at jerntorget dot se
20-Sep-2002 04:29
then use imap_get_quotaroot().....

or use this one (works with qmail):
function get_quotaroot() {
if(!$socket = @fsockopen("your server", your port);
    return false;
fgets($socket, 1024);
fputs($socket, "a001 LOGIN ".$username." ".$password."\n");
fgets($socket, 1024);
fputs($socket, "a002 GETQUOTAROOT INBOX\n");
fgets($socket, 1024);
$result = fgets($socket, 1024);
fputs($socket, "a003 LOGOUT\n");
fgets($socket, 1024);
sscanf($result, '* QUOTA "ROOT" (STORAGE %d %d MESSAGE %d %d', $usedSize, $maxSize, $usedNum, $maxNum);
return array("usedSize" => $usedSize, "maxSize" => $maxSize, "usedNum" => $usedNum, "maxNum" => $maxNum);
}
stephane-wantiez at tiscalinet dot be
11-Aug-2002 10:13
imap_get_quota need you to be the admin of the mail server !
dolce at koulikov dot cc
13-Jan-2002 07:57
Don't lie... I've timed it, there is merely a time difference, besides it returns a lot of other useful info packed in an object!
whw at my169 dot com
04-Jan-2002 04:35
It is very slow,so don't use it to get mailbox size,used imap_get_quota instead.

imap_mime_header_decode> <imap_mail
Last updated: Fri, 03 Oct 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites