listMailboxes() публичный Метод

Obtain a list of mailboxes matching a pattern.
public listMailboxes ( mixed $pattern, integer $mode = Horde_Imap_Client::MBOX_ALL, array $options = [] ) : array
$pattern mixed The mailbox search pattern(s) (see RFC 3501 [6.3.8] for the format). A UTF-8 string or an array of strings. If a Horde_Imap_Client_Mailbox object is given, it is escaped (i.e. wildcard patterns are converted to return the miminal number of matches possible).
$mode integer Which mailboxes to return. Either: - Horde_Imap_Client::MBOX_SUBSCRIBED Return subscribed mailboxes. - Horde_Imap_Client::MBOX_SUBSCRIBED_EXISTS Return subscribed mailboxes that exist on the server. - Horde_Imap_Client::MBOX_UNSUBSCRIBED Return unsubscribed mailboxes. - Horde_Imap_Client::MBOX_ALL Return all mailboxes regardless of subscription status. - Horde_Imap_Client::MBOX_ALL_SUBSCRIBED (@since 2.23.0) Return all mailboxes regardless of subscription status, and ensure the '\subscribed' attribute is set if mailbox is subscribed (implies 'attributes' option is true).
$options array Additional options:
  - attributes: (boolean) If true, return attribute information under
                the 'attributes' key.
                DEFAULT: Do not return this information.
  - children: (boolean) Tell server to return children attribute
              information (\HasChildren, \HasNoChildren). Requires the
              LIST-EXTENDED extension to guarantee this information is
              returned. Server MAY return this attribute without this
              option, or if the CHILDREN extension is available, but it
              is not guaranteed.
              DEFAULT: false
  - flat: (boolean) If true, return a flat list of mailbox names only.
          Overrides the 'attributes' option.
          DEFAULT: Do not return flat list.
  - recursivematch: (boolean) Force the server to return information
                    about parent mailboxes that don't match other
                    selection options, but have some sub-mailboxes that
                    do. Information about children is returned in the
                    CHILDINFO extended data item ('extended'). Requires
                    the LIST-EXTENDED extension.
                    DEFAULT: false
  - remote: (boolean) Tell server to return mailboxes that reside on
            another server. Requires the LIST-EXTENDED extension.
            DEFAULT: false
  - special_use: (boolean) Tell server to return special-use attribute
                 information (see Horde_Imap_Client SPECIALUSE_*
                 constants). Server must support the SPECIAL-USE return
                 option for this setting to have any effect.
                 DEFAULT: false
  - status: (integer) Tell server to return status information. The
            value is a bitmask that may contain any of:
    - Horde_Imap_Client::STATUS_MESSAGES
    - Horde_Imap_Client::STATUS_RECENT
    - Horde_Imap_Client::STATUS_UIDNEXT
    - Horde_Imap_Client::STATUS_UIDVALIDITY
    - Horde_Imap_Client::STATUS_UNSEEN
    - Horde_Imap_Client::STATUS_HIGHESTMODSEQ
    DEFAULT: 0
  - sort: (boolean) If true, return a sorted list of mailboxes?
          DEFAULT: Do not sort the list.
  - sort_delimiter: (string) If 'sort' is true, this is the delimiter
                    used to sort the mailboxes.
                    DEFAULT: '.'
Результат array If 'flat' option is true, the array values are a list of Horde_Imap_Client_Mailbox objects. Otherwise, the keys are UTF-8 mailbox names and the values are arrays with these keys: - attributes: (array) List of lower-cased attributes [only if 'attributes' option is true]. - delimiter: (string) The delimiter for the mailbox. - extended: (TODO) TODO [only if 'recursivematch' option is true and LIST-EXTENDED extension is supported on the server]. - mailbox: (Horde_Imap_Client_Mailbox) The mailbox object. - status: (array) See status() [only if 'status' option is true].
Пример #1
0
 /**
  * Checks whether a mailbox exists and is set up properly.
  *
  * @param string $user    The name of the mailbox to check.
  * @param string $domain  The mailbox' domain.
  *
  * @return boolean  True if the mailbox exists.
  * @throws Vilma_Exception if the mailbox doesn't exist.
  */
 public function checkMailbox($user, $domain)
 {
     if (!$this->_imap->listMailboxes($this->_params['userhierarchy'] . $user . '@' . $domain)) {
         throw new Vilma_Exception(sprintf(_("Mailbox \"%s\" does not exist."), $user . '@' . $domain));
     }
     return true;
 }