imap_get_quotaroot

(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)

imap_get_quotarootObtener la cuota de ajustes por usuario

Descripción

imap_get_quotaroot(resource $imap_stream, string $quota_root): array

Obtnener la cuota de ajustes por usuario. EL valor límite representa la cantidad total de espacio permitido para este uso de buzón total de usuario. El valor del uso representa la capacidad de buzón total del usuario actual.

Parámetros

imap_stream

IMAP stream devuelto por imap_open().

quota_root

quota_root normalmente debería estar en la forma de su buzón (es decir, INBOX).

Valores devueltos

Devuelve un array de valores concernientes al buzón del usuario especificado. Todos los valores contienen una clave basada en el nombre del recurso, y dentro un array correspondiente al los valores uso y límite.

Esta función devolverá false en el caso de fallo de llamada, y un array de información acerca de la conexión sobre una respuesta no analizable desde el servidor.

Ejemplos

Ejemplo #1 Ejemplo de imap_get_quotaroot()

<?php
$mbox
= imap_open("{imap.example.org}", "kalowsky", "password", OP_HALFOPEN)
or die(
"no se pudo conectar: " . imap_last_error());

$cuota = imap_get_quotaroot($mbox, "INBOX");
if (
is_array($cuota)) {
$almacén = $cuota['STORAGE'];
echo
"El nivel de uso de STORAGE es: " . $almacén['usage'];
echo
"El nivel de uso de STORAGE es: " . $almacén['limit'];

$mensaje = $cuota['MESSAGE'];
echo
"El nivel de uso de MESSAGE es: " . $mensaje['usage'];
echo
"El nivel de uso de MESSAGE es: " . $mensaje['limit'];

/* ... */

}

imap_close($mbox);
?>

Notas

Esta función actualmente sólo está disponible para usuarios de la biblioteca c-client2000 o superior.

imap_stream debería estar abierto mientras se compruebe el buzón del usuario en cuestión.

Ver también

add a note

User Contributed Notes 3 notes

up
5
thomas dot hebinck at digionline dot de
19 years ago
['STORAGE']['usage'] and ['STORAGE']['limit'] are values in KB (1024 Bytes)
up
2
uphonesimon at gmail dot com
17 years ago
just to make a note for all the people that are wondering the differences between $quota['STORAGE'] and $quot['MESSAGE']
the $quot['STORAGE'] is the size of the mailbox in KB
but $quota['MESSAGE'] is actually the number of messages stored in the mailbox and the up limit of the total messages allowed
up
-4
rodrigo dot tsuru at tsuru dot net
18 years ago
The example above isn't right. Replace with this:

<?php
$mbox
= imap_open("{your.imap.host}", "kalowsky", "password", OP_HALFOPEN)
     or die(
"can't connect: " . imap_last_error());

$quota = imap_get_quotaroot($mbox, "INBOX");
if (
is_array($quota)) {
  
$storage = $quota['STORAGE'];
   echo
"STORAGE usage level is: " $storage['usage'];
   echo
"STORAGE limit level is: " $storage['limit'];

  
$message = $quota['MESSAGE'];
   echo
"MESSAGE usage level is: " $message['usage'];
   echo
"MESSAGE usage level is: " $message['limit'];

  
/* ...  */

}

imap_close($mbox);
?>
To Top