<HTML ><HEAD ><TITLE >imap_get_quota</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Manual de PHP" HREF="index.html"><LINK REL="UP" TITLE="Funciones IMAP" HREF="ref.imap.html"><LINK REL="PREVIOUS" TITLE="imap_fetchstructure" HREF="function.imap-fetchstructure.html"><LINK REL="NEXT" TITLE="imap_get_quotaroot" HREF="function.imap-get-quotaroot.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual de PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.imap-fetchstructure.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.imap-get-quotaroot.html" ACCESSKEY="N" >Siguiente</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.imap-get-quota" ></A >imap_get_quota</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN29728" ></A ><P > (PHP 4 >= 4.0.5)</P >imap_get_quota -- Retrieve the quota level settings, and usage statics per mailbox </DIV ><DIV CLASS="refsect1" ><A NAME="AEN29731" ></A ><H2 >Description</H2 >array <B CLASS="methodname" >imap_get_quota</B > ( resource imap_stream, string quota_root)<BR ></BR ><P > Returns an array with integer values limit and usage for the given mailbox. The value of limit represents the total amount of space allowed for this mailbox. The usage value represents the mailboxes current level of capacity. Will return <TT CLASS="constant" ><B >FALSE</B ></TT > in the case of failure. </P ><P > This function is currently only available to users of the c-client2000 or greater library. </P ><P > NOTE: For this function to work, the mail stream is required to be opened as the mail-admin user. For a non-admin user version of this function, please see the <A HREF="function.imap-get-quotaroot.html" ><B CLASS="function" >imap_get_quotaroot()</B ></A > function of PHP. </P ><P > <TT CLASS="parameter" ><I >imap_stream</I ></TT > should be the value returned from an <A HREF="function.imap-open.html" ><B CLASS="function" >imap_open()</B ></A > call. NOTE: This stream is required to be opened as the mail admin user for the get_quota function to work. <TT CLASS="parameter" ><I >quota_root</I ></TT > should normally be in the form of user.name where name is the mailbox you wish to retrieve information about. </P ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN29752" ></A ><P ><B >Ejemplo 1. <B CLASS="function" >imap_get_quota()</B > example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >$mbox = imap_open("{your.imap.host}","mailadmin","password",OP_HALFOPEN) or die("can't connect: ".imap_last_error()); $quota_value = imap_get_quota($mbox, "user.kalowsky"); if(is_array($quota_value)) { print "Usage level is: " . $quota_value['usage']; print "Limit level is: " . $quota_value['limit']; } imap_close($mbox);</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><P > As of PHP version 4.3, the function more properly reflects the functionality as dictated by the RFC 2087. The array return value has changed to support an unlimited number of returned resources (i.e. messages, or sub-folders) with each named resource receiving an individual array key. Each key value then contains an another array with the usage and limit values within it. The example below shows the updated returned output. </P ><P > For backwards compatibility reasons, the originial access methods are still available for use, although it is suggested to update. </P ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN29759" ></A ><P ><B >Ejemplo 2. <B CLASS="function" >imap_get_quota()</B > 4.3 or greater example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >$mbox = imap_open("{your.imap.host}","mailadmin","password",OP_HALFOPEN) or die("can't connect: ".imap_last_error()); $quota_values = imap_get_quota($mbox, "user.kalowsky"); if(is_array($quota_values)) { $storage = $quota_values['STORAGE']; print "STORAGE usage level is: " . $storage['usage']; print "STORAGE limit level is: " . $storage['limit']; $message = $quota_values['MESSAGE']; print "MESSAGE usage level is: " . $message['usage']; print "MESSAGE usage level is: " . $message['limit']; /* ... */ } imap_close($mbox);</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><P > See also <A HREF="function.imap-open.html" ><B CLASS="function" >imap_open()</B ></A >, <A HREF="function.imap-set-quota.html" ><B CLASS="function" >imap_set_quota()</B ></A >, <A HREF="function.imap-get-quotaroot.html" ><B CLASS="function" >imap_get_quotaroot()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.imap-fetchstructure.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Inicio</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.imap-get-quotaroot.html" ACCESSKEY="N" >Siguiente</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >imap_fetchstructure</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.imap.html" ACCESSKEY="U" >Subir</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >imap_get_quotaroot</TD ></TR ></TABLE ></DIV ></BODY ></HTML >