1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/imap.xml, last change in rev 1.2 -->
<refentry id="function.imap-getmailboxes">
<refnamediv>
<refname>imap_getmailboxes</refname>
<refpurpose>
Read the list of mailboxes, returning detailed information on
each one
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>imap_getmailboxes</methodname>
<methodparam><type>resource</type><parameter>imap_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>ref</parameter></methodparam>
<methodparam><type>string</type><parameter>pattern</parameter></methodparam>
</methodsynopsis>
<para>
Returns an array of objects containing mailbox information. Each
object has the attributes <parameter>name</parameter>, specifying
the full name of the mailbox; <parameter>delimiter</parameter>,
which is the hierarchy delimiter for the part of the hierarchy
this mailbox is in; and
<parameter>attributes</parameter>. <parameter>Attributes</parameter>
is a bitmask that can be tested against:
<itemizedlist>
<listitem>
<simpara>
<constant>LATT_NOINFERIORS</constant> - This mailbox has no
"children" (there are no mailboxes below this one).
</simpara>
</listitem>
<listitem>
<simpara>
<constant>LATT_NOSELECT</constant> - This is only a container,
not a mailbox - you cannot open it.
</simpara>
</listitem>
<listitem>
<simpara>
<constant>LATT_MARKED</constant> - This mailbox is marked.
Only used by UW-IMAPD.
</simpara>
</listitem>
<listitem>
<simpara>
<constant>LATT_UNMARKED</constant> - This mailbox is not marked.
Only used by UW-IMAPD.
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
Mailbox names containing international Characters outside the
printable ASCII range will be encoded and may be decoded by
<function>imap_utf7_decode</function>.
</para>
<para>
<parameter>ref</parameter> should normally be just the server
specification as described in <function>imap_open</function>, and
<parameter>pattern</parameter> specifies where in the mailbox
hierarchy to start searching. If you want all mailboxes, pass
'*' for <parameter>pattern</parameter>.
</para>
<para>
There are two special characters you can pass as part of the
<parameter>pattern</parameter>: '*' and '%'. '*' means to return
all mailboxes. If you pass <parameter>pattern</parameter> as '*',
you will get a list of the entire mailbox hierarchy. '%' means to
return the current level only. '%' as the
<parameter>pattern</parameter> parameter will return only the top
level mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox
in the ~/mail directory, but none in subfolders of that
directory.
</para>
<para>
<example>
<title><function>imap_getmailboxes</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$mbox = imap_open("{your.imap.host}", "username", "password", OP_HALFOPEN)
or die("can't connect: " . imap_last_error());
$list = imap_getmailboxes($mbox, "{your.imap.host}", "*");
if (is_array($list)) {
reset($list);
while (list($key, $val) = each($list)) {
echo "($key) ";
echo imap_utf7_decode($val->name) . ",";
echo "'" . $val->delimiter . "',";
echo $val->attributes . "<br />\n";
}
} else {
echo "imap_getmailboxes failed: " . imap_last_error() . "\n";
}
imap_close($mbox);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>imap_getsubscribed</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
|