Overview

Packages

  • Imap
    • Client

Classes

  • Horde_Imap_Client
  • Horde_Imap_Client_Auth_DigestMD5
  • Horde_Imap_Client_Base
  • Horde_Imap_Client_Cache
  • Horde_Imap_Client_Data_Acl
  • Horde_Imap_Client_Data_AclCommon
  • Horde_Imap_Client_Data_AclNegative
  • Horde_Imap_Client_Data_AclRights
  • Horde_Imap_Client_Data_Envelope
  • Horde_Imap_Client_Data_Fetch
  • Horde_Imap_Client_Data_Fetch_Pop3
  • Horde_Imap_Client_Data_Thread
  • Horde_Imap_Client_DateTime
  • Horde_Imap_Client_Exception
  • Horde_Imap_Client_Exception_NoSupportExtension
  • Horde_Imap_Client_Fetch_Query
  • Horde_Imap_Client_Ids
  • Horde_Imap_Client_Ids_Pop3
  • Horde_Imap_Client_Mailbox
  • Horde_Imap_Client_Search_Query
  • Horde_Imap_Client_Socket
  • Horde_Imap_Client_Socket_Pop3
  • Horde_Imap_Client_Sort
  • Horde_Imap_Client_Translation
  • Horde_Imap_Client_Utf7imap
  • Horde_Imap_Client_Utils
  • Horde_Imap_Client_Utils_Pop3
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Imap_Client_Base

An abstracted API interface to IMAP backends supporting the IMAP4rev1 protocol (RFC 3501).

Copyright 2008-2012 Horde LLC (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Horde_Imap_Client_Base implements Serializable

Direct known subclasses

Horde_Imap_Client_Socket, Horde_Imap_Client_Socket_Pop3
Abstract
Package: Imap\Client
Category: Horde
License: LGPL 2.1
Author: Michael Slusarz slusarz@horde.org
Located at Horde/Imap/Client/Base.php
Methods summary
public
# __construct( array $params = array() )

Constructor.

Constructor.

Parameters

$params
<p>A hash containing configuration parameters. See Horde_Imap_Client::factory().</p>

See

Horde_Imap_Client::factory()
public
# __destruct( )

Destructor.

Destructor.

public
# serialize( )

Implementation of

Serializable::serialize()
public
# unserialize( mixed $data )

Implementation of

Serializable::unserialize()
public
# __get( mixed $name )
public
# _setInit( string $key = null, mixed $val = null )

Set an initialization value.

Set an initialization value.

Parameters

$key
The initialization key. If null, resets all keys.
$val
The cached value. If null, removes the key.
public
# fetchCacheIgnore( array $mboxes )

Update the list of ignored mailboxes for caching FETCH data.

Update the list of ignored mailboxes for caching FETCH data.

Parameters

$mboxes
The list of mailboxes to ignore.
public mixed
# getParam( string $key )

Returns a value from the internal params array.

Returns a value from the internal params array.

Parameters

$key
The param key.

Returns

mixed
The param value, or null if not found.
public
# setParam( string $key, mixed $val )

Sets a configuration parameter value.

Sets a configuration parameter value.

Parameters

$key
The param key.
$val
$value The param value.

Since

1.5.0
public mixed
# getCache( )

Returns the Horde_Imap_Client_Cache object used, if available.

Returns the Horde_Imap_Client_Cache object used, if available.

Returns

mixed
Either the object or null.
public Horde_Imap_Client_Ids
# getIdsOb( mixed $ids = null, boolean $sequence = false )

Returns the correct IDs object for use with this driver.

Returns the correct IDs object for use with this driver.

Parameters

$ids
See self::add().
$sequence
Are $ids message sequence numbers?

Returns

Horde_Imap_Client_Ids
The IDs object.
public
# queryCapability( string $capability )

Returns whether the IMAP server supports the given capability (See RFC 3501 [6.1.1]).

Returns whether the IMAP server supports the given capability (See RFC 3501 [6.1.1]).

Parameters

$capability
The capability string to query.
public array
# capability( )

Get CAPABILITY information from the IMAP server.

Get CAPABILITY information from the IMAP server.

Returns

array
The capability array.

Throws

Horde_Imap_Client_Exception
public
# noop( )

Send a NOOP command (RFC 3501 [6.1.2]).

Send a NOOP command (RFC 3501 [6.1.2]).

Throws

Horde_Imap_Client_Exception
public array
# getNamespaces( array $additional = array() )

Get the NAMESPACE information from the IMAP server (RFC 2342).

Get the NAMESPACE information from the IMAP server (RFC 2342).

Parameters

$additional
<p>If the server supports namespaces, any additional namespaces to add to the namespace list that are not broadcast by the server. The namespaces must be UTF-8 strings.</p>

Returns

array

An array of namespace information with the name as the key (UTF7-IMAP) and the following values:

  • delimiter: (string) The namespace delimiter.
  • hidden: (boolean) Is this a hidden namespace?
  • name: (string) The namespace name (UTF7-IMAP).
  • translation: (string) Returns the translated name of the namespace (UTF-8). Requires RFC 5255 and a previous call to setLanguage().
  • type: (integer) The namespace type. Either:
    • Horde_Imap_Client::NS_PERSONAL
    • Horde_Imap_Client::NS_OTHER
    • Horde_Imap_Client::NS_SHARED

Throws

Horde_Imap_Client_Exception
public boolean
# isSecureConnection( )

Display if connection to the server has been secured via TLS or SSL.

Display if connection to the server has been secured via TLS or SSL.

Returns

boolean
True if the IMAP connection is secured.
abstract public array
# alerts( )

Return a list of alerts that MUST be presented to the user (RFC 3501 [7.1]).

Return a list of alerts that MUST be presented to the user (RFC 3501 [7.1]).

Returns

array
An array of alert messages.
public
# login( )

Login to the IMAP server.

Login to the IMAP server.

Throws

Horde_Imap_Client_Exception
public
# logout( )

Logout from the IMAP server (see RFC 3501 [6.1.3]).

Logout from the IMAP server (see RFC 3501 [6.1.3]).

public
# sendID( array $info = null )

Send ID information to the IMAP server (RFC 2971).

Send ID information to the IMAP server (RFC 2971).

Parameters

$info
<p>Overrides the value of the 'id' param and sends this information instead.</p>

Throws

Horde_Imap_Client_Exception
Horde_Imap_Client_Exception_NoSupportExtension
public array
# getID( )

Return ID information from the IMAP server (RFC 2971).

Return ID information from the IMAP server (RFC 2971).

Returns

array

An array of information returned, with the keys as the 'field' and the values as the 'value'.

Throws

Horde_Imap_Client_Exception
public string
# setLanguage( array $langs = null )

Sets the preferred language for server response messages (RFC 5255).

Sets the preferred language for server response messages (RFC 5255).

Parameters

$langs
<p>Overrides the value of the 'lang' param and sends this list of preferred languages instead. The special string 'i-default' can be used to restore the language to the server default.</p>

Returns

string

The language accepted by the server, or null if the default language is used.

Throws

Horde_Imap_Client_Exception
public mixed
# getLanguage( array $list = false )

Gets the preferred language for server response messages (RFC 5255).

Gets the preferred language for server response messages (RFC 5255).

Parameters

$list
If true, return the list of available languages.

Returns

mixed

If $list is true, the list of languages available on the server (may be empty). If false, the language used by the server, or null if the default language is used.

Throws

Horde_Imap_Client_Exception
public
# openMailbox( mixed $mailbox, integer $mode = Horde_Imap_Client::OPEN_AUTO )

Open a mailbox.

Open a mailbox.

Parameters

$mailbox
<p>The mailbox to open. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$mode
<p>The access mode. Either - Horde_Imap_Client::OPEN_READONLY - Horde_Imap_Client::OPEN_READWRITE - Horde_Imap_Client::OPEN_AUTO</p>

Throws

Horde_Imap_Client_Exception
public mixed
# currentMailbox( )

Return the currently opened mailbox and access mode.

Return the currently opened mailbox and access mode.

Returns

mixed

Null if no mailbox selected, or an array with two elements: - mailbox: (mixed) If 'utf8' is true, returns a Horde_Imap_Client_Mailbox object. Otherwise, returns a string (UTF7-IMAP; DEPRECATED). - mode: (integer) Current mode.

Throws

Horde_Imap_Client_Exception
public
# createMailbox( mixed $mailbox, array $opts = array() )

Create a mailbox.

Create a mailbox.

Parameters

$mailbox
<p>The mailbox to create. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$opts
<p>Additional options: - special_use: (array) An array of special-use flags to mark the mailbox with. The server MUST support RFC 6154.</p>

Throws

Horde_Imap_Client_Exception
public
# deleteMailbox( mixed $mailbox )

Delete a mailbox.

Delete a mailbox.

Parameters

$mailbox
<p>The mailbox to delete. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>

Throws

Horde_Imap_Client_Exception
public
# renameMailbox( mixed $old, mixed $new )

Rename a mailbox.

Rename a mailbox.

Parameters

$old
<p>The old mailbox name. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$new
<p>The new mailbox name. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>

Throws

Horde_Imap_Client_Exception
public
# subscribeMailbox( mixed $mailbox, boolean $subscribe = true )

Manage subscription status for a mailbox.

Manage subscription status for a mailbox.

Parameters

$mailbox
<p>The mailbox to [un]subscribe to. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$subscribe
True to subscribe, false to unsubscribe.

Throws

Horde_Imap_Client_Exception
public array
# listMailboxes( mixed $pattern, integer $mode = Horde_Imap_Client::MBOX_ALL, array $options = array() )

Obtain a list of mailboxes matching a pattern.

Obtain a list of mailboxes matching a pattern.

Parameters

$pattern
<p>The mailbox search pattern(s) (see RFC 3501 [6.3.8] for the format). A UTF-8 string or an array of strings.</p>
$mode
<p>Which mailboxes to return. Either: - Horde_Imap_Client::MBOX_SUBSCRIBED - Horde_Imap_Client::MBOX_SUBSCRIBED_EXISTS - Horde_Imap_Client::MBOX_UNSUBSCRIBED - Horde_Imap_Client::MBOX_ALL</p>
$options
Additional options: <ul> <li> attributes: (boolean) If true, return attribute information under the 'attributes' key. DEFAULT: Do not return this information. </li> <li> 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 </li> <li> delimiter: (boolean) If true, return delimiter information under the 'delimiter' key. DEFAULT: Do not return this information. </li> <li> flat: (boolean) If true, return a flat list of mailbox names only. Overrides both the 'attributes' and 'delimiter' options. DEFAULT: Do not return flat list. </li> <li> recursivematch: (boolean) Force the server to return information about parent mailboxes that don't match other selection options, but have some submailboxes that do. Information about children is returned in the CHILDINFO extended data item ('extended'). Requires the LIST-EXTENDED extension. DEFAULT: false </li> <li> remote: (boolean) Tell server to return mailboxes that reside on another server. Requires the LIST-EXTENDED extension. DEFAULT: false </li> <li> special_use: (boolean) Tell server to return special-use attribute information (\Drafts, \Flagged, \Junk, \Sent, \Trash, \All, \Archive). Server must support the SPECIAL-USE return option for this setting to have any effect. Server MAY return this attribute without this option. DEFAULT: false <li> status: (integer) Tell server to return status information. The value is a bitmask that may contain any of: <ul> <li>Horde_Imap_Client::STATUS_MESSAGES</li> <li>Horde_Imap_Client::STATUS_RECENT</li> <li>Horde_Imap_Client::STATUS_UIDNEXT</li> <li>Horde_Imap_Client::STATUS_UIDVALIDITY</li> <li>Horde_Imap_Client::STATUS_UNSEEN</li> <li>Horde_Imap_Client::STATUS_HIGHESTMODSEQ</li> </ul> Requires the LIST-STATUS extension. DEFAULT: 0 </li> <li> sort: (boolean) If true, return a sorted list of mailboxes? DEFAULT: Do not sort the list. </li> <li> sort_delimiter: (string) If 'sort' is true, this is the delimiter used to sort the mailboxes. DEFAULT: '.' </li> <li> utf8: (boolean) True to return mailbox names in UTF-8. DEFAULT: Names are returned in UTF7-IMAP. </li> </ul>

Returns

array

If 'flat' option is true, the array values are a list of Horde_Imap_Client_Mailbox objects (if the 'utf8' parameter is true) or a list of UTF7-IMAP strings. Otherwise, the array 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 [only if 'delimiter' option is true]. - extended: (TODO) TODO [only if 'recursivematch' option is true and LIST-EXTENDED extension is supported on the server]. - mailbox: (mixed) The mailbox. A Horde_Imap_Client_Mailbox object if the 'utf8' parameter is true, or a UTF7-IMAP string. - status: (array) See status() [only if 'status' option is true and LIST-STATUS extension is supported on the server].

Throws

Horde_Imap_Client_Exception
public array
# status( mixed $mailbox, integer $flags = Horde_Imap_Client::STATUS_ALL )

Obtain status information for a mailbox.

Obtain status information for a mailbox.

Parameters

$mailbox
<p>The mailbox to query. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$flags
<p>A bitmask of information requested from the server. Allowed flags:</p> <ul> <li> Horde_Imap_Client::STATUS_MESSAGES <ul> <li> Return key: messages </li> <li> Return format: (integer) The number of messages in the mailbox. </li> </ul> </li> <li> Horde_Imap_Client::STATUS_RECENT <ul> <li> Return key: recent </li> <li> Return format: (integer) The number of messages with the \Recent flag set </li> </ul> </li> <li> Horde_Imap_Client::STATUS_UIDNEXT <ul> <li> Return key: uidnext </li> <li> Return format: (integer) The next UID to be assigned in the mailbox. </li> </ul> </li> <li> Horde_Imap_Client::STATUS_UIDVALIDITY <ul> <li> Return key: uidvalidity </li> <li> Return format: (integer) The unique identifier validity of the mailbox. </li> </ul> </li> <li> Horde_Imap_Client::STATUS_UNSEEN <ul> <li> Return key: unseen </li> <li> Return format: (integer) The number of messages which do not have the \Seen flag set. </li> </ul> </li> <li> Horde_Imap_Client::STATUS_FIRSTUNSEEN <ul> <li> Return key: firstunseen </li> <li> Return format: (integer) The sequence number of the first unseen message in the mailbox. </li> </ul> </li> <li> Horde_Imap_Client::STATUS_FLAGS <ul> <li> Return key: flags </li> <li> Return format: (array) The list of defined flags in the mailbox (all flags are in lowercase). </li> </ul> </li> <li> Horde_Imap_Client::STATUS_PERMFLAGS <ul> <li> Return key: permflags </li> <li> Return format: (array) The list of flags that a client can change permanently (all flags are in lowercase). </li> </ul> </li> <li> Horde_Imap_Client::STATUS_HIGHESTMODSEQ <ul> <li> Return key: highestmodseq </li> <li> Return format: (integer) If the server supports the CONDSTORE IMAP extension, this will be the highest mod-sequence value of all messages in the mailbox. Else 0 if CONDSTORE not available or the mailbox does not support mod-sequences. </li> </ul> </li> <li> Horde_Imap_Client::STATUS_LASTMODSEQ <ul> <li> Return key: lastmodseq </li> <li> Return format: (integer) If the server supports the CONDSTORE IMAP extension, this will be the cached mod-sequence value of the mailbox when it was first opened if HIGHESTMODSEQ changed. Else 0 if CONDSTORE not available, the mailbox does not support mod-sequences, or the mod-sequence did not change. </li> </ul> </li> <li> Horde_Imap_Client::STATUS_LASTMODSEQUIDS <ul> <li> Return key: lastmodsequids </li> <li> Return format: (array) If the server supports the QRESYNC IMAP extension, this will be the list of UIDs changed in the mailbox when it was first opened if HIGHESTMODSEQ changed. Else an empty array if QRESYNC not available, the mailbox does not support mod-sequences, or the mod-sequence did not change. </li> </ul> </li> <li> Horde_Imap_Client::STATUS_UIDNOTSTICKY <ul> <li> Return key: uidnotsticky </li> <li> Return format: (boolean) If the server supports the UIDPLUS IMAP extension, and the queried mailbox does not support persistent UIDs, this value will be true. In all other cases, this value will be false. </li> </ul> </li> <li> Horde_Imap_Client::STATUS_ALL (DEFAULT) <ul> <li> Shortcut to return 'messages', 'recent', 'uidnext', 'uidvalidity', and 'unseen' values. </li> </ul> </li> </ul>

Returns

array
An array with the requested keys (see above).

Throws

Horde_Imap_Client_Exception
public array
# statusMultiple( array $mailboxes, integer $flags = Horde_Imap_Client::STATUS_ALL, array $opts = array() )

Perform a STATUS call on multiple mailboxes at the same time.

Perform a STATUS call on multiple mailboxes at the same time.

This method leverages the LIST-EXTENDED and LIST-STATUS extensions on the IMAP server to improve the efficiency of this operation.

Parameters

$mailboxes
<p>The mailboxes to query. Either Horde_Imap_Client_Mailbox objects (as of 1.2.0), strings (UTF-8), or a combination of the two.</p>
$flags
See status().
$opts
<p>Additional options: - sort: (boolean) If true, sort the 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: '.'</p>

Returns

array

An array with the keys as the mailbox names (UTF7-IMAP) and the values as arrays with the requested keys (from the mask given in $flags).

public Horde_Imap_Client_Ids
# append( mixed $mailbox, array $data, array $options = array() )

Append message(s) to a mailbox.

Append message(s) to a mailbox.

Parameters

$mailbox
<p>The mailbox to append the message(s) to. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$data
<p>The message data to append, along with additional options. An array of arrays with each embedded array having the following entries:</p> <ul> <li> data: (mixed) The data to append. If a string or a stream resource, this will be used as the entire contents of a single message. If an array, will catenate all given parts into a single message. This array contains one or more arrays with two keys: <ul> <li> t: (string) Either 'url' or 'text'. </li> <li> v: (mixed) If 't' is 'url', this is the IMAP URL to the message part to append. If 't' is 'text', this is either a string or resource representation of the message part data. DEFAULT: NONE (entry is MANDATORY) </li> </ul> </li> <li> flags: (array) An array of flags/keywords to set on the appended message. DEFAULT: Only the \Recent flag is set. </li> <li> internaldate: (DateTime) The internaldate to set for the appended message. DEFAULT: internaldate will be the same date as when the message was appended. </li> </ul>
$options
<p>Additonal options: - create: (boolean) Try to create $mailbox if it does not exist? DEFAULT: No.</p>

Returns

Horde_Imap_Client_Ids
The UIDs of the appended messages.

Throws

Horde_Imap_Client_Exception
public
# check( )

Request a checkpoint of the currently selected mailbox (RFC 3501 [6.4.1]).

Request a checkpoint of the currently selected mailbox (RFC 3501 [6.4.1]).

Throws

Horde_Imap_Client_Exception
public
# close( array $options = array() )

Close the connection to the currently selected mailbox, optionally expunging all deleted messages (RFC 3501 [6.4.2]).

Close the connection to the currently selected mailbox, optionally expunging all deleted messages (RFC 3501 [6.4.2]).

Parameters

$options
<p>Additional options: - expunge: (boolean) Expunge all messages flagged as deleted? DEFAULT: No</p>

Throws

Horde_Imap_Client_Exception
public Horde_Imap_Client_Ids
# expunge( mixed $mailbox, array $options = array() )

Expunge deleted messages from the given mailbox.

Expunge deleted messages from the given mailbox.

Parameters

$mailbox
<p>The mailbox to expunge. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$options
<p>Additional options: - ids: (Horde_Imap_Client_Ids) A list of messages to expunge, but only if they are also flagged as deleted. DEFAULT: All messages marked as deleted will be expunged. - list: (boolean) If true, returns the list of expunged messages. DEFAULT: false</p>

Returns

Horde_Imap_Client_Ids

If 'list' option is true, returns the list of expunged messages.

Throws

Horde_Imap_Client_Exception
public array
# search( mixed $mailbox, Horde_Imap_Client_Search_Query $query = null, array $options = array() )

Search a mailbox.

Search a mailbox.

Parameters

$mailbox
<p>The mailbox to search. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$query
<p>The search query. Defaults to an ALL search.</p>
$options
Additional options: <ul> <li> nocache: (boolean) Don't cache the results. DEFAULT: false (results cached, if possible) </li> <li> partial: (mixed) The range of results to return (message sequence numbers). DEFAULT: All messages are returned. </li> <li> results: (array) The data to return. Consists of zero or more of the following flags: <ul> <li>Horde_Imap_Client::SEARCH_RESULTS_COUNT</li> <li>Horde_Imap_Client::SEARCH_RESULTS_MATCH (DEFAULT)</li> <li>Horde_Imap_Client::SEARCH_RESULTS_MAX</li> <li>Horde_Imap_Client::SEARCH_RESULTS_MIN</li> <li> Horde_Imap_Client::SEARCH_RESULTS_SAVE (This option is currently meant for internal use only) </li> <li>Horde_Imap_Client::SEARCH_RESULTS_RELEVANCY</li> </ul> </li> <li> sequence: (boolean) If true, returns an array of sequence numbers. DEFAULT: Returns an array of UIDs </li> <li> sort: (array) Sort the returned list of messages. Multiple sort criteria can be specified. Any sort criteria can be sorted in reverse order (instead of the default ascending order) by adding a Horde_Imap_Client::SORT_REVERSE element to the array directly before adding the sort element. The following sort criteria are available: <ul> <li>Horde_Imap_Client::SORT_ARRIVAL</li> <li>Horde_Imap_Client::SORT_CC</li> <li>Horde_Imap_Client::SORT_DATE</li> <li>Horde_Imap_Client::SORT_FROM</li> <li>Horde_Imap_Client::SORT_SEQUENCE</li> <li>Horde_Imap_Client::SORT_SIZE</li> <li>Horde_Imap_Client::SORT_SUBJECT</li> <li>Horde_Imap_Client::SORT_TO</li> <li> [On servers that support SORT=DISPLAY, these criteria are also available:] <ul> <li>Horde_Imap_Client::SORT_DISPLAYFROM</li> <li>Horde_Imap_Client::SORT_DISPLAYTO</li> </ul> </li> <li> [On servers that support SEARCH=FUZZY, this criteria is also available:] <ul> <li>Horde_Imap_Client::SORT_RELEVANCY</li> </ul> </li> </ul> </li> </ul>

Returns

array

An array with the following keys: - count: (integer) The number of messages that match the search criteria. Always returned. - match: (Horde_Imap_Client_Ids) The IDs that match $criteria, sorted if the 'sort' modifier was set. Returned if Horde_Imap_Client::SEARCH_RESULTS_MATCH is set. - max: (integer) The UID (default) or message sequence number (if 'sequence' is true) of the highest message that satisifies $criteria. Returns null if no matches found. Returned if Horde_Imap_Client::SEARCH_RESULTS_MAX is set. - min: (integer) The UID (default) or message sequence number (if 'sequence' is true) of the lowest message that satisifies $criteria. Returns null if no matches found. Returned if Horde_Imap_Client::SEARCH_RESULTS_MIN is set. - modseq: (integer) The highest mod-sequence for all messages being returned. Returned if 'sort' is false, the search query includes a MODSEQ command, and the server supports the CONDSTORE IMAP extension. - relevancy: (array) The list of relevancy scores. Returned if Horde_Imap_Client::SEARCH_RESULTS_RELEVANCY is set and the server supports FUZZY search matching. - save: (boolean) Whether the search results were saved. This value is meant for internal use only. Returned if 'sort' is false and Horde_Imap_Client::SEARCH_RESULTS_SAVE is set.

Throws

Horde_Imap_Client_Exception
public
# setComparator( string $comparator = null )

Set the comparator to use for searching/sorting (RFC 5255).

Set the comparator to use for searching/sorting (RFC 5255).

Parameters

$comparator
<p>The comparator string (see RFC 4790 [3.1] - "collation-id" - for format). The reserved string 'default' can be used to select the default comparator.</p>

Throws

Horde_Imap_Client_Exception
Horde_Imap_Client_Exception_NoSupportExtension
public mixed
# getComparator( )

Get the comparator used for searching/sorting (RFC 5255).

Get the comparator used for searching/sorting (RFC 5255).

Returns

mixed

Null if the default comparator is being used, or an array of comparator information (see RFC 5255 [4.8]).

Throws

Horde_Imap_Client_Exception
public Horde_Imap_Client_Data_Thread
# thread( mixed $mailbox, array $options = array() )

Thread sort a given list of messages (RFC 5256).

Thread sort a given list of messages (RFC 5256).

Parameters

$mailbox
<p>The mailbox to query. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$options
Additional options: <ul> <li> criteria: (mixed) The following thread criteria are available: <ul> <li>Horde_Imap_Client::THREAD_ORDEREDSUBJECT</li> <li>Horde_Imap_Client::THREAD_REFERENCES</li> <li>Horde_Imap_Client::THREAD_REFS</li> <li> Other algorithms can be explicitly specified by passing the IMAP thread algorithm in as a string value. </li> </ul> DEFAULT: Horde_Imap_Client::THREAD_ORDEREDSUBJECT </li> <li> search: (Horde_Imap_Client_Search_Query) The search query. DEFAULT: All messages in mailbox included in thread sort. </li> <li> sequence: (boolean) If true, each message is stored and referred to by its message sequence number. DEFAULT: Stored/referred to by UID. </li> </ul>

Returns

Horde_Imap_Client_Data_Thread
A thread data object.

Throws

Horde_Imap_Client_Exception
public array
# fetch( mixed $mailbox, Horde_Imap_Client_Fetch_Query $query, array $options = array() )

Fetch message data (see RFC 3501 [6.4.5]).

Fetch message data (see RFC 3501 [6.4.5]).

Parameters

$mailbox
<p>The mailbox to search. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$query
Fetch query object.
$options
<p>Additional options: - changedsince: (integer) Only return messages that have a mod-sequence larger than this value. This option requires the CONDSTORE IMAP extension (if not present, this value is ignored). Additionally, the mailbox must support mod-sequences or an exception will be thrown. If valid, this option implicity adds the mod-sequence fetch criteria to the fetch command. DEFAULT: Mod-sequence values are ignored. - fetch_res: (array) A partial results array to have fetch results added to. [DEPRECATED] - ids: (Horde_Imap_Client_Ids) A list of messages to fetch data from. DEFAULT: All messages in $mailbox will be fetched. - vanished: (boolean) Only return messages from the UID set parameter that have been expunged and whose associated mod-sequence is larger than the specified mod-sequence. This option requires the QRESYNC IMAP extension and requires 'changedsince' to be set, and requires 'ids' to be UIDs. [DEPRECATED] DEFAULT: Vanished search ignored.</p>

Returns

array

An array of fetch results. The array consists of keys that correspond to 'ids', and values that contain Horde_Imap_Query_Data_Fetch objects.

Throws

Horde_Imap_Client_Exception
public Horde_Imap_Client_Ids
# store( mixed $mailbox, array $options = array() )

Store message flag data (see RFC 3501 [6.4.6]).

Store message flag data (see RFC 3501 [6.4.6]).

Parameters

$mailbox
<p>The mailbox containing the messages to modify. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$options
<p>Additional options: - add: (array) An array of flags to add. DEFAULT: No flags added. - ids: (Horde_Imap_Client_Ids) The list of messages to modify. DEFAULT: All messages in $mailbox will be modified. - remove: (array) An array of flags to remove. DEFAULT: No flags removed. - replace: (array) Replace the current flags with this set of flags. Overrides both the 'add' and 'remove' options. DEFAULT: No replace is performed. - unchangedsince: (integer) Only changes flags if the mod-sequence ID of the message is equal or less than this value. Requires the CONDSTORE IMAP extension on the server. Also requires the mailbox to support mod-sequences. Will throw an exception if either condition is not met. DEFAULT: mod-sequence is ignored when applying changes</p>

Returns

Horde_Imap_Client_Ids

A Horde_Imap_Client_Ids object containing the list of IDs that failed the 'unchangedsince' test.

Throws

Horde_Imap_Client_Exception
public mixed
# copy( mixed $source, mixed $dest, array $options = array() )

Copy messages to another mailbox.

Copy messages to another mailbox.

Parameters

$source
<p>The source mailbox. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$dest
<p>The destination mailbox. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$options
<p>Additional options: - create: (boolean) Try to create $dest if it does not exist? DEFAULT: No. - ids: (Horde_Imap_Client_Ids) The list of messages to copy. DEFAULT: All messages in $mailbox will be copied. - move: (boolean) If true, delete the original messages. DEFAULT: Original messages are not deleted.</p>

Returns

mixed

An array mapping old UIDs (keys) to new UIDs (values) on success (if the IMAP server and/or driver support the UIDPLUS extension) or true.

Throws

Horde_Imap_Client_Exception
public
# setQuota( mixed $root, array $resources = array() )

Set quota limits. The server must support the IMAP QUOTA extension (RFC 2087).

Set quota limits. The server must support the IMAP QUOTA extension (RFC 2087).

Parameters

$root
<p>The quota root. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$resources
<p>The resource values to set. Keys are the resource atom name; value is the resource value.</p>

Throws

Horde_Imap_Client_Exception
public mixed
# getQuota( mixed $root )

Get quota limits. The server must support the IMAP QUOTA extension (RFC 2087).

Get quota limits. The server must support the IMAP QUOTA extension (RFC 2087).

Parameters

$root
<p>The quota root. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>

Returns

mixed

An array with resource keys. Each key holds an array with 2 values: 'limit' and 'usage'.

Throws

Horde_Imap_Client_Exception
public mixed
# getQuotaRoot( mixed $mailbox )

Get quota limits for a mailbox. The server must support the IMAP QUOTA extension (RFC 2087).

Get quota limits for a mailbox. The server must support the IMAP QUOTA extension (RFC 2087).

Parameters

$mailbox
<p>A mailbox. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>

Returns

mixed

An array with the keys being the quota roots. Each key holds an array with resource keys: each of these keys holds an array with 2 values: 'limit' and 'usage'.

Throws

Horde_Imap_Client_Exception
public array
# getACL( mixed $mailbox )

Get the ACL rights for a given mailbox. The server must support the IMAP ACL extension (RFC 2086/4314).

Get the ACL rights for a given mailbox. The server must support the IMAP ACL extension (RFC 2086/4314).

Parameters

$mailbox
<p>A mailbox. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>

Returns

array

An array with identifiers as the keys and Horde_Imap_Client_Data_Acl objects as the values.

Throws

Horde_Imap_Client_Exception
public
# setACL( mixed $mailbox, string $identifier, array $options )

Set ACL rights for a given mailbox/identifier.

Set ACL rights for a given mailbox/identifier.

Parameters

$mailbox
<p>A mailbox. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$identifier
The identifier to alter (UTF-8).
$options
<p>Additional options: - remove: (boolean) If true, removes rights for $identifier. DEFAULT: false - rights: (string) The rights to alter. DEFAULT: If 'remove' is true, removes all rights. If 'remove' is false, no rights are altered.</p>

Throws

Horde_Imap_Client_Exception
public Horde_Imap_Client_Data_AclRights
# listACLRights( mixed $mailbox, string $identifier )

List the ACL rights for a given mailbox/identifier. The server must support the IMAP ACL extension (RFC 2086/4314).

List the ACL rights for a given mailbox/identifier. The server must support the IMAP ACL extension (RFC 2086/4314).

Parameters

$mailbox
<p>A mailbox. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$identifier
The identifier to query (UTF-8).

Returns

Horde_Imap_Client_Data_AclRights
An ACL data rights object.

Throws

Horde_Imap_Client_Exception
public Horde_Imap_Client_Data_Acl
# getMyACLRights( mixed $mailbox )

Get the ACL rights for the current user for a given mailbox. The server must support the IMAP ACL extension (RFC 2086/4314).

Get the ACL rights for the current user for a given mailbox. The server must support the IMAP ACL extension (RFC 2086/4314).

Parameters

$mailbox
<p>A mailbox. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>

Returns

Horde_Imap_Client_Data_Acl
An ACL data object.

Throws

Horde_Imap_Client_Exception
public array
# allAclRights( )

Return master list of ACL rights available on the server.

Return master list of ACL rights available on the server.

Returns

array
A list of ACL rights.
public array
# getMetadata( mixed $mailbox, array $entries, array $options = array() )

Get metadata for a given mailbox. The server must support either the IMAP METADATA extension (RFC 5464) or the ANNOTATEMORE extension (http://ietfreport.isoc.org/idref/draft-daboo-imap-annotatemore/).

Get metadata for a given mailbox. The server must support either the IMAP METADATA extension (RFC 5464) or the ANNOTATEMORE extension (http://ietfreport.isoc.org/idref/draft-daboo-imap-annotatemore/).

Parameters

$mailbox
<p>A mailbox. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$entries
The entries to fetch (UTF-8 strings).
$options
<p>Additional options: - depth: (string) Either "0", "1" or "infinity". Returns only the given value (0), only values one level below the specified value (1) or all entries below the specified value (infinity). - maxsize: (integer) The maximal size the returned values may have. DEFAULT: No maximal size.</p>

Returns

array

An array with metadata names as the keys and metadata values as the values. If 'maxsize' is set, and entries exist on the server larger than this size, the size will be returned in the key '*longentries'.

Throws

Horde_Imap_Client_Exception
public
# setMetadata( mixed $mailbox, array $data )

Set metadata for a given mailbox/identifier.

Set metadata for a given mailbox/identifier.

Parameters

$mailbox
<p>A mailbox. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8). If empty, sets a server annotation.</p>
$data
<p>A set of data values. The metadata values corresponding to the keys of the array will be set to the values in the array.</p>

Throws

Horde_Imap_Client_Exception
public string
# getCacheId( mixed $mailbox, array $addl = array() )

Returns a unique identifier for the current mailbox status.

Returns a unique identifier for the current mailbox status.

Parameters

$mailbox
<p>A mailbox. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$addl
<p>Additional cache info to add to the cache ID string.</p>

Returns

string

The cache ID string, which will change when the composition of the mailbox changes. The uidvalidity will always be the first element, and will be delimited by the '|' character.

Throws

Horde_Imap_Client_Exception
public array
# parseCacheId( string $id )

Parses a cacheID created by getCacheId().

Parses a cacheID created by getCacheId().

Parameters

$id
The cache ID.

Returns

array

An array with the following information: - highestmodseq: (integer) - messages: (integer) - uidnext: (integer) - uidvalidity: (integer) Always present

public resource
# fetchFromSectionString( mixed $mailbox, integer $uid, string $section = null )

Given an IMAP body section string, fetches the corresponding part.

Given an IMAP body section string, fetches the corresponding part.

Parameters

$mailbox
<p>A mailbox. Either a Horde_Imap_Client_Mailbox object (as of 1.2.0) or a string (UTF-8).</p>
$uid
The IMAP UID.
$section
The IMAP section string.

Returns

resource

The section contents in a stream. Returns null if the part could not be found.

Throws

Horde_Imap_Client_Exception
public boolean
# validSearchCharset( string $charset )

Determines if the given charset is valid for search-related queries. This check pertains just to the basic IMAP SEARCH command.

Determines if the given charset is valid for search-related queries. This check pertains just to the basic IMAP SEARCH command.

Parameters

$charset
The query charset.

Returns

boolean
True if server supports this charset.
public
# writeDebug( string $msg, string $type = Horde_Imap_Client::DEBUG_RAW )

Output debug information.

Output debug information.

Parameters

$msg
Debug line.
$type
<p>The message type. One of the following: - Horde_Imap_Client::DEBUG_RAW: None (output raw message) - Horde_Imap_Client::DEBUG_CLIENT: Client command - Horde_Imap_Client::DEBUG_INFO: Informational message - Horde_Imap_Client::DEBUG_SERVER: Server command</p>
Constants summary
integer VERSION
# 1
string CACHE_MODSEQ
# 'HICmodseq'
string CACHE_SEARCH
# 'HICsearch'
Properties summary
public Horde_Imap_Client_Cache $cache

The Horde_Imap_Client_Cache object.

The Horde_Imap_Client_Cache object.

# null
public array $cacheFields

The list of fetch fields that can be cached, and their cache names.

The list of fetch fields that can be cached, and their cache names.

# array( Horde_Imap_Client::FETCH_ENVELOPE => 'HICenv', Horde_Imap_Client::FETCH_FLAGS => 'HICflags', Horde_Imap_Client::FETCH_HEADERS => 'HIChdrs', Horde_Imap_Client::FETCH_IMAPDATE => 'HICdate', Horde_Imap_Client::FETCH_SIZE => 'HICsize', Horde_Imap_Client::FETCH_STRUCTURE => 'HICstruct' )
public boolean $changed

Has the internal configuration changed?

Has the internal configuration changed?

# false
Magic properties summary
public Horde_Imap_Client_Utils $utils

A Utils object.

API documentation generated by ApiGen