PHP Class Horde_Imap_Client_Base, horde

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.
Author: Michael Slusarz ([email protected])
Inheritance: implements Serializable
Show file Open project: horde/horde Class Usage Examples

Public Properties

Property Type Description
$cacheFields array The list of fetch fields that can be cached, and their cache names.
$changed boolean Has the internal configuration changed?
$statuscache boolean Horde_Imap_Client is optimized for short (i.e. 1 seconds) scripts. It makes heavy use of mailbox caching to save on server accesses. This property should be set to false for long-running scripts, or else status() data may not reflect the current state of the mailbox on the server.

Protected Properties

Property Type Description
$_alerts Horde_Imap_Client_Base_Alerts Alerts reporting object.
$_cache Horde_Imap_Client_Cache The Horde_Imap_Client_Cache object.
$_connection Horde\Socket\Client Connection to the IMAP server.
$_debug Horde_Imap_Client_Base_Debug The debug object.
$_defaultPorts array First element is non-secure, second is SSL.
$_fetchDataClass string The fetch data object type to return.
$_init array Cached server data.
$_isAuthenticated boolean Is there an active authenticated connection to the IMAP Server?
$_mode integer The current mailbox selection mode.
$_params array This hash never changes.
$_selected Horde_Imap_Client_Mailbox The currently selected mailbox.
$_temp array Temp array (destroyed at end of process).

Public Methods

Method Description
__clone ( ) This object can not be cloned.
__construct ( array $params = [] ) Constructor.
__get ( $name )
_setInit ( string $key = null, mixed $val = null ) Set an initialization value.
alerts ( ) : array Return a list of alerts that MUST be presented to the user (RFC 3501 [7.1]).
allAclRights ( ) : array Return master list of ACL rights available on the server.
append ( mixed $mailbox, array $data, array $options = [] ) : Horde_Imap_Client_Ids Append message(s) to a mailbox.
capability ( ) : array Get CAPABILITY information from the IMAP server.
check ( ) Request a checkpoint of the currently selected mailbox (RFC 3501 [6.4.1]).
close ( array $options = [] ) Close the connection to the currently selected mailbox, optionally expunging all deleted messages (RFC 3501 [6.4.2]).
copy ( mixed $source, mixed $dest, array $options = [] ) : mixed Copy messages to another mailbox.
createMailbox ( mixed $mailbox, array $opts = [] ) Create a mailbox.
currentMailbox ( ) : mixed Return the currently opened mailbox and access mode.
deleteACL ( mixed $mailbox, string $identifier ) Deletes ACL rights for a given mailbox/identifier.
deleteMailbox ( mixed $mailbox ) Delete a mailbox.
expunge ( mixed $mailbox, array $options = [] ) : Horde_Imap_Client_Ids Expunge deleted messages from the given mailbox.
fetch ( mixed $mailbox, Horde_Imap_Client_Fetch_Query $query, array $options = [] ) : Horde_Imap_Client_Fetch_Results Fetch message data (see RFC 3501 [6.4.5]).
getACL ( mixed $mailbox ) : array Get the ACL rights for a given mailbox. The server must support the IMAP ACL extension (RFC 2086/4314).
getCache ( ) : mixed Returns the Horde_Imap_Client_Cache object used, if available.
getCacheId ( mixed $mailbox, array $addl = [] ) : string Returns a unique identifier for the current mailbox status.
getComparator ( ) : mixed Get the comparator used for searching/sorting (RFC 5255).
getID ( ) : array Return ID information from the IMAP server (RFC 2971).
getIdsOb ( mixed $ids = null, boolean $sequence = false ) : Horde_Imap_Client_Ids Returns the correct IDs object for use with this driver.
getLanguage ( array $list = false ) : mixed Gets the preferred language for server response messages (RFC 5255).
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/).
getMyACLRights ( mixed $mailbox ) : Horde_Imap_Client_Data_Acl Get the ACL rights for the current user for a given mailbox. The server must support the IMAP ACL extension (RFC 2086/4314).
getNamespaces ( array $additional = [], array $opts = [] ) : mixed Get the NAMESPACE information from the IMAP server (RFC 2342).
getParam ( string $key ) : mixed Returns a value from the internal params array.
getQuota ( mixed $root ) : mixed Get quota limits. The server must support the IMAP QUOTA extension (RFC 2087).
getQuotaRoot ( mixed $mailbox ) : mixed Get quota limits for a mailbox. The server must support the IMAP QUOTA extension (RFC 2087).
getSyncToken ( mixed $mailbox ) : string Returns a unique token for the current mailbox synchronization status.
isSecureConnection ( ) : boolean Display if connection to the server has been secured via TLS or SSL.
listACLRights ( mixed $mailbox, string $identifier ) : Horde_Imap_Client_Data_AclRights List the ACL rights for a given mailbox/identifier. The server must support the IMAP ACL extension (RFC 2086/4314).
listMailboxes ( mixed $pattern, integer $mode = Horde_Imap_Client::MBOX_ALL, array $options = [] ) : array Obtain a list of mailboxes matching a pattern.
login ( ) Login to the IMAP server.
logout ( ) Logout from the IMAP server (see RFC 3501 [6.1.3]).
noop ( ) Send a NOOP command (RFC 3501 [6.1.2]).
openMailbox ( mixed $mailbox, integer $mode = Horde_Imap_Client::OPEN_AUTO ) Open a mailbox.
parseCacheId ( string $id ) : array Parses a cacheID created by getCacheId().
queryCapability ( string $capability ) : mixed Returns whether the IMAP server supports the given capability (See RFC 3501 [6.1.1]).
renameMailbox ( mixed $old, mixed $new ) Rename a mailbox.
resolveIds ( Horde_Imap_Client_Mailbox $mailbox, Horde_Imap_Client_Ids $ids, integer $convert ) : Horde_Imap_Client_Ids Resolves an IDs object into a list of IDs.
search ( mixed $mailbox, Horde_Imap_Client_Search_Query $query = null, array $options = [] ) : array Search a mailbox.
sendID ( array $info = null ) Send ID information to the IMAP server (RFC 2971).
serialize ( )
setACL ( mixed $mailbox, string $identifier, array $options ) Set ACL rights for a given mailbox/identifier.
setComparator ( string $comparator = null ) Set the comparator to use for searching/sorting (RFC 5255).
setLanguage ( array $langs = null ) : string Sets the preferred language for server response messages (RFC 5255).
setMetadata ( mixed $mailbox, array $data ) Set metadata for a given mailbox/identifier.
setParam ( string $key, mixed $val ) Sets a configuration parameter value.
setQuota ( mixed $root, array $resources = [] ) Set quota limits. The server must support the IMAP QUOTA extension (RFC 2087).
shutdown ( ) Shutdown actions.
status ( mixed $mailbox, integer $flags = Horde_Imap_Client::STATUS_ALL, array $opts = [] ) : array Obtain status information for a mailbox.
statusMultiple ( array $mailboxes, integer $flags = Horde_Imap_Client::STATUS_ALL, array $opts = [] ) : array Perform a STATUS call on multiple mailboxes at the same time.
store ( mixed $mailbox, array $options = [] ) : Horde_Imap_Client_Ids Store message flag data (see RFC 3501 [6.4.6]).
subscribeMailbox ( mixed $mailbox, boolean $subscribe = true ) Manage subscription status for a mailbox.
sync ( mixed $mailbox, string $token, array $opts = [] ) : Horde_Imap_Client_Data_Sync Synchronize a mailbox from a sync token.
thread ( mixed $mailbox, array $options = [] ) : Horde_Imap_Client_Data_Thread Thread sort a given list of messages (RFC 5256).
unserialize ( $data )
update ( SplSubject $subject )
validSearchCharset ( string $charset ) : boolean Determines if the given charset is valid for search-related queries.
vanished ( mixed $mailbox, integer $modseq, array $opts = [] ) : Horde_Imap_Client_Ids Get the list of vanished messages (UIDs that have been expunged since a given mod-sequence value).

Protected Methods

Method Description
_append ( Horde_Imap_Client_Mailbox $mailbox, array $data, array $options ) : mixed Append message(s) to a mailbox.
_cacheFields ( ) : array Provide the list of available caching fields.
_capability ( ) : mixed Query server capability.
_changeSelected ( mixed $mailbox = null, integer $mode = null ) Called when the selected mailbox is changed.
_check ( ) Request a checkpoint of the currently selected mailbox.
_close ( array $options ) Close the connection to the currently selected mailbox, optionally expunging all deleted messages (RFC 3501 [6.4.2]).
_condstoreSync ( ) Synchronizes the current mailbox cache with the server (using CONDSTORE or QRESYNC).
_connect ( ) Connect to the remote server.
_copy ( Horde_Imap_Client_Mailbox $dest, array $options ) : mixed Copy messages to another mailbox.
_createMailbox ( Horde_Imap_Client_Mailbox $mailbox, array $opts ) Create a mailbox.
_deleteACL ( Horde_Imap_Client_Mailbox $mailbox, string $identifier ) Deletes ACL rights for a given mailbox/identifier.
_deleteMailbox ( Horde_Imap_Client_Mailbox $mailbox ) Delete a mailbox.
_deleteMailboxPost ( Horde_Imap_Client_Mailbox $mailbox ) Actions to perform after a mailbox delete.
_deleteMsgs ( Horde_Imap_Client_Mailbox $mailbox, Horde_Imap_Client_Ids $ids, array $opts = [] ) : Horde_Imap_Client_Ids Delete messages in the cache.
_expunge ( array $options ) : Horde_Imap_Client_Ids Expunge all deleted messages from the given mailbox.
_fetch ( Horde_Imap_Client_Fetch_Results $results, array $queries ) Fetch message data.
_getACL ( Horde_Imap_Client_Mailbox $mailbox ) : array Get ACL rights for a given mailbox.
_getComparator ( ) : mixed Get the comparator used for searching/sorting (RFC 5255).
_getEncryptKey ( ) : string Get encryption key.
_getID ( ) : array Return ID information from the IMAP server (RFC 2971).
_getLanguage ( array $list ) : mixed Gets the preferred language for server response messages (RFC 5255).
_getMetadata ( Horde_Imap_Client_Mailbox $mailbox, array $entries, array $options ) : array Get metadata for a given mailbox.
_getMyACLRights ( Horde_Imap_Client_Mailbox $mailbox ) : Horde_Imap_Client_Data_Acl Get the ACL rights for the current user for a given mailbox.
_getNamespaces ( ) : Horde_Imap_Client_Namespace_List Get the NAMESPACE information from the IMAP server.
_getQuota ( Horde_Imap_Client_Mailbox $root ) : mixed Get quota limits.
_getQuotaRoot ( Horde_Imap_Client_Mailbox $mailbox ) : mixed Get quota limits for a mailbox.
_getSearchCache ( string $type, array $options ) : mixed Retrieve data from the search cache.
_getUidByMessageId ( Horde_Imap_Client_Mailbox $mailbox, string $msgid ) : string Get a message UID by the Message-ID. Returns the last message in a mailbox that matches.
_initCache ( boolean $current = false ) : boolean Initialize the Horde_Imap_Client_Cache object, if necessary.
_initCapability ( ) Retrieve capability information from the IMAP server.
_initOb ( ) Do initialization tasks.
_listACLRights ( Horde_Imap_Client_Mailbox $mailbox, string $identifier ) : Horde_Imap_Client_Data_AclRights Get ACL rights for a given mailbox/identifier.
_listMailboxes ( array $pattern, integer $mode, array $options ) : array Obtain a list of mailboxes matching a pattern.
_login ( ) : boolean Login to the IMAP server.
_logout ( ) Logout from the IMAP server (see RFC 3501 [6.1.3]).
_mailboxOb ( string $mailbox = null ) : Horde_Imap_Client_Base_Mailbox Return the Horde_Imap_Client_Base_Mailbox object.
_moveCache ( Horde_Imap_Client_Mailbox $to, array $map, string $uidvalid ) Moves cache entries from the current mailbox to another mailbox.
_noop ( ) Send a NOOP command.
_openMailbox ( Horde_Imap_Client_Mailbox $mailbox, integer $mode ) Open a mailbox.
_renameMailbox ( Horde_Imap_Client_Mailbox $old, Horde_Imap_Client_Mailbox $new ) Rename a mailbox.
_search ( object $query, array $options ) : Horde_Imap_Client_Ids Search a mailbox.
_sendID ( array $info ) Send ID information to the IMAP server (RFC 2971).
_setACL ( Horde_Imap_Client_Mailbox $mailbox, string $identifier, array $options ) Set ACL rights for a given mailbox/identifier.
_setComparator ( string $comparator ) Set the comparator to use for searching/sorting (RFC 5255).
_setLanguage ( array $langs ) : string Sets the preferred language for server response messages (RFC 5255).
_setMetadata ( Horde_Imap_Client_Mailbox $mailbox, array $data ) Set metadata for a given mailbox/identifier.
_setQuota ( Horde_Imap_Client_Mailbox $root, array $resources ) : boolean Set quota limits.
_setSearchCache ( mixed $data, string $sdata ) Set data in the search cache.
_status ( array $mboxes, integer $flags ) : array Obtain status information for mailboxes.
_store ( array $options ) : Horde_Imap_Client_Ids Store message flag data.
_subscribeMailbox ( Horde_Imap_Client_Mailbox $mailbox, boolean $subscribe ) Manage subscription status for a mailbox.
_syncStatus ( mixed $mailbox ) : array Return the current mailbox synchronization status.
_thread ( array $options ) : Horde_Imap_Client_Data_Thread Thread sort a given list of messages (RFC 5256).
_updateCache ( Horde_Imap_Client_Fetch_Results $data ) Store FETCH data in cache.
_updateModSeq ( integer $modseq ) : mixed Updates the cached MODSEQ value.
_vanished ( integer $modseq, Horde_Imap_Client_Ids $ids ) : Horde_Imap_Client_Ids Get the list of vanished messages.

Private Methods

Method Description
_fetchWrapper ( $mailbox, $query, $options ) Wrapper for fetch() to allow internal state to be reset on exception.

Method Details

__clone() public method

This object can not be cloned.
public __clone ( )

__construct() public method

Constructor.
public __construct ( array $params = [] )
$params array Configuration parameters:
- cache: (array) If set, caches data from fetch(), search(), and
         thread() calls. Requires the horde/Cache package to be
         installed. The array can contain the following keys (see
         Horde_Imap_Client_Cache for default values):
  - backend: [REQUIRED (or cacheob)] (Horde_Imap_Client_Cache_Backend)
             Backend cache driver [@since 2.9.0].
  - fetch_ignore: (array) A list of mailboxes to ignore when storing
                  fetch data.
  - fields: (array) The fetch criteria to cache. If not defined, all
            cacheable data is cached. The following is a list of
            criteria that can be cached:
    - Horde_Imap_Client::FETCH_ENVELOPE
    - Horde_Imap_Client::FETCH_FLAGS
      Only if server supports CONDSTORE extension
    - Horde_Imap_Client::FETCH_HEADERS
      Only for queries that specifically request caching
    - Horde_Imap_Client::FETCH_IMAPDATE
    - Horde_Imap_Client::FETCH_SIZE
    - Horde_Imap_Client::FETCH_STRUCTURE
- capability_ignore: (array) A list of IMAP capabilites to ignore, even
                     if they are supported on the server.
                     DEFAULT: No supported capabilities are ignored.
- comparator: (string) The search comparator to use instead of the
              default server comparator. See setComparator() for
              format.
              DEFAULT: Use the server default
- context: (array) Any context parameters passed to
           stream_create_context(). @since 2.27.0
- debug: (string) If set, will output debug information to the stream
         provided. The value can be any PHP supported wrapper that can
         be opened via PHP's fopen() function.
         DEFAULT: No debug output
- hostspec: (string) The hostname or IP address of the server.
            DEFAULT: 'localhost'
- id: (array) Send ID information to the server (only if server
      supports the ID extension). An array with the keys as the fields
      to send and the values being the associated values. See RFC 2971
      [3.3] for a list of standard field values.
      DEFAULT: No info sent to server
- lang: (array) A list of languages (in priority order) to be used to
        display human readable messages.
        DEFAULT: Messages output in IMAP server default language
- password: (mixed) The user password. Either a string or a
            Horde_Imap_Client_Base_Password object [@since 2.14.0].
- port: (integer) The server port to which we will connect.
        DEFAULT: 143 (imap or imap w/TLS) or 993 (imaps)
- secure: (string) Use SSL or TLS to connect. Values:
  - false (No encryption)
  - 'ssl' (Auto-detect SSL version)
  - 'sslv2' (Force SSL version 3)
  - 'sslv3' (Force SSL version 2)
  - 'tls' (TLS; started via protocol-level negotation over
    unencrypted channel; RECOMMENDED way of initiating secure
    connection)
  - 'tlsv1' (TLS direct version 1.x connection to server) [@since
    2.16.0]
  - true (TLS if available/necessary) [@since 2.15.0]
    DEFAULT: false
- timeout: (integer)  Connection timeout, in seconds.
           DEFAULT: 30 seconds
- username: (string) [REQUIRED] The username.

__get() public method

public __get ( $name )

_append() abstract protected method

Append message(s) to a mailbox.
abstract protected _append ( Horde_Imap_Client_Mailbox $mailbox, array $data, array $options ) : mixed
$mailbox Horde_Imap_Client_Mailbox The mailbox to append the message(s) to.
$data array The message data.
$options array Additional options.
return mixed A Horde_Imap_Client_Ids object containing the UIDs of the appended messages (if server supports UIDPLUS extension) or true.

_cacheFields() protected method

Provide the list of available caching fields.
protected _cacheFields ( ) : array
return array The list of available caching fields (fields are in the key).

_capability() protected method

Required because internal code can't call capability via magic method directly - it may not exist yet, the creation code may call capability recursively, and __get() doesn't allow recursive calls to the same property (chicken/egg issue).
protected _capability ( ) : mixed
return mixed The capability object if no arguments provided. If arguments are provided, they are passed to the query() method and this value is returned.

_changeSelected() protected method

Called when the selected mailbox is changed.
protected _changeSelected ( mixed $mailbox = null, integer $mode = null )
$mailbox mixed The selected mailbox or null.
$mode integer The access mode.

_check() abstract protected method

Request a checkpoint of the currently selected mailbox.
abstract protected _check ( )

_close() abstract protected method

Close the connection to the currently selected mailbox, optionally expunging all deleted messages (RFC 3501 [6.4.2]).
abstract protected _close ( array $options )
$options array Additional options.

_condstoreSync() protected method

Synchronizes the current mailbox cache with the server (using CONDSTORE or QRESYNC).
protected _condstoreSync ( )

_connect() abstract protected method

Connect to the remote server.
abstract protected _connect ( )

_copy() abstract protected method

Copy messages to another mailbox.
abstract protected _copy ( Horde_Imap_Client_Mailbox $dest, array $options ) : mixed
$dest Horde_Imap_Client_Mailbox The destination mailbox.
$options array Additional options.
return 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.

_createMailbox() abstract protected method

Create a mailbox.
abstract protected _createMailbox ( Horde_Imap_Client_Mailbox $mailbox, array $opts )
$mailbox Horde_Imap_Client_Mailbox The mailbox to create.
$opts array Additional options. See createMailbox().

_deleteACL() abstract protected method

Deletes ACL rights for a given mailbox/identifier.
abstract protected _deleteACL ( Horde_Imap_Client_Mailbox $mailbox, string $identifier )
$mailbox Horde_Imap_Client_Mailbox A mailbox.
$identifier string The identifier to delete (UTF7-IMAP).

_deleteMailbox() abstract protected method

Delete a mailbox.
abstract protected _deleteMailbox ( Horde_Imap_Client_Mailbox $mailbox )
$mailbox Horde_Imap_Client_Mailbox The mailbox to delete.

_deleteMailboxPost() protected method

Actions to perform after a mailbox delete.
protected _deleteMailboxPost ( Horde_Imap_Client_Mailbox $mailbox )
$mailbox Horde_Imap_Client_Mailbox The deleted mailbox.

_deleteMsgs() protected method

Delete messages in the cache.
protected _deleteMsgs ( Horde_Imap_Client_Mailbox $mailbox, Horde_Imap_Client_Ids $ids, array $opts = [] ) : Horde_Imap_Client_Ids
$mailbox Horde_Imap_Client_Mailbox The mailbox.
$ids Horde_Imap_Client_Ids The list of IDs to delete in $mailbox.
$opts array Additional options (not used in base class).
return Horde_Imap_Client_Ids UIDs that were deleted.

_expunge() abstract protected method

Expunge all deleted messages from the given mailbox.
abstract protected _expunge ( array $options ) : Horde_Imap_Client_Ids
$options array Additional options.
return Horde_Imap_Client_Ids If 'list' option is true, returns the list of expunged messages.

_fetch() abstract protected method

Fetch queries should be grouped in the $queries argument. Each value is an array of fetch options, with the fetch query stored in the '_query' parameter. IMPORTANT: All queries must have the same ID type (either sequence or UID).
abstract protected _fetch ( Horde_Imap_Client_Fetch_Results $results, array $queries )
$results Horde_Imap_Client_Fetch_Results Fetch results.
$queries array The list of queries.

_getACL() abstract protected method

Get ACL rights for a given mailbox.
abstract protected _getACL ( Horde_Imap_Client_Mailbox $mailbox ) : array
$mailbox Horde_Imap_Client_Mailbox A mailbox.
return array An array with identifiers as the keys and Horde_Imap_Client_Data_Acl objects as the values.

_getComparator() abstract protected method

Get the comparator used for searching/sorting (RFC 5255).
abstract protected _getComparator ( ) : mixed
return mixed Null if the default comparator is being used, or an array of comparator information (see RFC 5255 [4.8]).

_getEncryptKey() protected method

Get encryption key.
Deprecation: Pass callable into 'password' parameter instead.
protected _getEncryptKey ( ) : string
return string The encryption key.

_getID() abstract protected method

Return ID information from the IMAP server (RFC 2971).
abstract protected _getID ( ) : array
return array An array of information returned, with the keys as the 'field' and the values as the 'value'.

_getLanguage() abstract protected method

Gets the preferred language for server response messages (RFC 5255).
abstract protected _getLanguage ( array $list ) : mixed
$list array If true, return the list of available languages.
return 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.

_getMetadata() abstract protected method

Get metadata for a given mailbox.
abstract protected _getMetadata ( Horde_Imap_Client_Mailbox $mailbox, array $entries, array $options ) : array
$mailbox Horde_Imap_Client_Mailbox A mailbox.
$entries array The entries to fetch (UTF7-IMAP strings).
$options array Additional options.
return array An array with metadata names as the keys and metadata values as the values.

_getMyACLRights() abstract protected method

Get the ACL rights for the current user for a given mailbox.
abstract protected _getMyACLRights ( Horde_Imap_Client_Mailbox $mailbox ) : Horde_Imap_Client_Data_Acl
$mailbox Horde_Imap_Client_Mailbox A mailbox.
return Horde_Imap_Client_Data_Acl An ACL data object.

_getNamespaces() abstract protected method

Get the NAMESPACE information from the IMAP server.
abstract protected _getNamespaces ( ) : Horde_Imap_Client_Namespace_List
return Horde_Imap_Client_Namespace_List Namespace list object.

_getQuota() abstract protected method

Get quota limits.
abstract protected _getQuota ( Horde_Imap_Client_Mailbox $root ) : mixed
$root Horde_Imap_Client_Mailbox The quota root.
return mixed An array with resource keys. Each key holds an array with 2 values: 'limit' and 'usage'.

_getQuotaRoot() abstract protected method

Get quota limits for a mailbox.
abstract protected _getQuotaRoot ( Horde_Imap_Client_Mailbox $mailbox ) : mixed
$mailbox Horde_Imap_Client_Mailbox A mailbox.
return 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'.

_getSearchCache() protected method

Retrieve data from the search cache.
protected _getSearchCache ( string $type, array $options ) : mixed
$type string The cache type ('search' or 'thread').
$options array The options array of the calling function.
return mixed Returns search cache metadata. If search was retrieved, data is in key 'data'. Returns null if caching is not available.

_getUidByMessageId() protected method

Get a message UID by the Message-ID. Returns the last message in a mailbox that matches.
protected _getUidByMessageId ( Horde_Imap_Client_Mailbox $mailbox, string $msgid ) : string
$mailbox Horde_Imap_Client_Mailbox The mailbox to search
$msgid string Message-ID.
return string UID (null if not found).

_initCache() protected method

Initialize the Horde_Imap_Client_Cache object, if necessary.
protected _initCache ( boolean $current = false ) : boolean
$current boolean If true, we are going to update the currently selected mailbox. Add an additional check to see if caching is available in current mailbox.
return boolean Returns true if caching is enabled.

_initCapability() abstract protected method

Retrieve capability information from the IMAP server.
abstract protected _initCapability ( )

_initOb() protected method

Do initialization tasks.
protected _initOb ( )

_listACLRights() abstract protected method

Get ACL rights for a given mailbox/identifier.
abstract protected _listACLRights ( Horde_Imap_Client_Mailbox $mailbox, string $identifier ) : Horde_Imap_Client_Data_AclRights
$mailbox Horde_Imap_Client_Mailbox A mailbox.
$identifier string The identifier to query (UTF7-IMAP).
return Horde_Imap_Client_Data_AclRights An ACL data rights object.

_listMailboxes() abstract protected method

Obtain a list of mailboxes matching a pattern.
abstract protected _listMailboxes ( array $pattern, integer $mode, array $options ) : array
$pattern array The mailbox search patterns (Horde_Imap_Client_Mailbox objects).
$mode integer Which mailboxes to return.
$options array Additional options.
return array See listMailboxes().

_login() abstract protected method

Login to the IMAP server.
abstract protected _login ( ) : boolean
return boolean Return true if global login tasks should be run.

_logout() abstract protected method

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

_mailboxOb() protected method

Return the Horde_Imap_Client_Base_Mailbox object.
protected _mailboxOb ( string $mailbox = null ) : Horde_Imap_Client_Base_Mailbox
$mailbox string The mailbox name. Defaults to currently selected mailbox.
return Horde_Imap_Client_Base_Mailbox Mailbox object.

_moveCache() protected method

Moves cache entries from the current mailbox to another mailbox.
protected _moveCache ( Horde_Imap_Client_Mailbox $to, array $map, string $uidvalid )
$to Horde_Imap_Client_Mailbox The destination mailbox.
$map array Mapping of source UIDs (keys) to destination UIDs (values).
$uidvalid string UIDVALIDITY of destination mailbox.

_noop() abstract protected method

Send a NOOP command.
abstract protected _noop ( )

_openMailbox() abstract protected method

Open a mailbox.
abstract protected _openMailbox ( Horde_Imap_Client_Mailbox $mailbox, integer $mode )
$mailbox Horde_Imap_Client_Mailbox The mailbox to open.
$mode integer The access mode.

_renameMailbox() abstract protected method

Rename a mailbox.
abstract protected _renameMailbox ( Horde_Imap_Client_Mailbox $old, Horde_Imap_Client_Mailbox $new )
$old Horde_Imap_Client_Mailbox The old mailbox name.
$new Horde_Imap_Client_Mailbox The new mailbox name.

_sendID() abstract protected method

Send ID information to the IMAP server (RFC 2971).
abstract protected _sendID ( array $info )
$info array The information to send to the server.

_setACL() abstract protected method

Set ACL rights for a given mailbox/identifier.
abstract protected _setACL ( Horde_Imap_Client_Mailbox $mailbox, string $identifier, array $options )
$mailbox Horde_Imap_Client_Mailbox A mailbox.
$identifier string The identifier to alter (UTF7-IMAP).
$options array Additional options. 'rights' contains the string of rights to set on the server.

_setComparator() abstract protected method

Set the comparator to use for searching/sorting (RFC 5255).
abstract protected _setComparator ( string $comparator )
$comparator string The comparator string (see RFC 4790 [3.1] - "collation-id" - for format). The reserved string 'default' can be used to select the default comparator.

_setInit() public method

Set an initialization value.
public _setInit ( string $key = null, mixed $val = null )
$key string The initialization key. If null, resets all keys.
$val mixed The cached value. If null, removes the key.

_setLanguage() abstract protected method

Sets the preferred language for server response messages (RFC 5255).
abstract protected _setLanguage ( array $langs ) : string
$langs array The preferred list of languages.
return string The language accepted by the server, or null if the default language is used.

_setMetadata() abstract protected method

Set metadata for a given mailbox/identifier.
abstract protected _setMetadata ( Horde_Imap_Client_Mailbox $mailbox, array $data )
$mailbox Horde_Imap_Client_Mailbox A mailbox.
$data array A set of data values. See setMetadata() for format.

_setQuota() abstract protected method

Set quota limits.
abstract protected _setQuota ( Horde_Imap_Client_Mailbox $root, array $resources ) : boolean
$root Horde_Imap_Client_Mailbox The quota root.
$resources array The resource values to set.
return boolean True on success.

_setSearchCache() protected method

Set data in the search cache.
protected _setSearchCache ( mixed $data, string $sdata )
$data mixed The cache data to store.
$sdata string The search data returned from _getSearchCache().

_status() abstract protected method

Obtain status information for mailboxes.
abstract protected _status ( array $mboxes, integer $flags ) : array
$mboxes array The list of mailbox objects to query.
$flags integer A bitmask of information requested from the server.
return array See array return for status().

_store() abstract protected method

Store message flag data.
abstract protected _store ( array $options ) : Horde_Imap_Client_Ids
$options array Additional options.
return Horde_Imap_Client_Ids A Horde_Imap_Client_Ids object containing the list of IDs that failed the 'unchangedsince' test.

_subscribeMailbox() abstract protected method

Manage subscription status for a mailbox.
abstract protected _subscribeMailbox ( Horde_Imap_Client_Mailbox $mailbox, boolean $subscribe )
$mailbox Horde_Imap_Client_Mailbox The mailbox to [un]subscribe to.
$subscribe boolean True to subscribe, false to unsubscribe.

_syncStatus() protected method

Return the current mailbox synchronization status.
protected _syncStatus ( mixed $mailbox ) : array
$mailbox mixed A mailbox. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
return array An array with status data. (This data is not guaranteed to have any specific format).

_thread() abstract protected method

Thread sort a given list of messages (RFC 5256).
abstract protected _thread ( array $options ) : Horde_Imap_Client_Data_Thread
$options array Additional options. See thread().
return Horde_Imap_Client_Data_Thread A thread data object.

_updateCache() protected method

Store FETCH data in cache.
protected _updateCache ( Horde_Imap_Client_Fetch_Results $data )
$data Horde_Imap_Client_Fetch_Results The fetch results.

_updateModSeq() protected method

Updates the cached MODSEQ value.
protected _updateModSeq ( integer $modseq ) : mixed
$modseq integer MODSEQ value to store.
return mixed The MODSEQ of the old value if it was replaced (or false if it didn't exist or is the same).

_vanished() abstract protected method

Get the list of vanished messages.
abstract protected _vanished ( integer $modseq, Horde_Imap_Client_Ids $ids ) : Horde_Imap_Client_Ids
$modseq integer Mod-sequence value.
$ids Horde_Imap_Client_Ids UIDs.
return Horde_Imap_Client_Ids List of UIDs that have vanished.

alerts() public method

Return a list of alerts that MUST be presented to the user (RFC 3501 [7.1]).
Deprecation: Add an observer to the $alerts_ob property instead.
public alerts ( ) : array
return array An array of alert messages.

allAclRights() public method

Return master list of ACL rights available on the server.
public allAclRights ( ) : array
return array A list of ACL rights.

append() public method

Append message(s) to a mailbox.
public append ( mixed $mailbox, array $data, array $options = [] ) : Horde_Imap_Client_Ids
$mailbox mixed The mailbox to append the message(s) to. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$data array The message data to append, along with additional options. An array of arrays with each embedded array having the following entries:
  - 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:
    - t: (string) Either 'url' or 'text'.
    - 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)
  - flags: (array) An array of flags/keywords to set on the appended
           message.
           DEFAULT: Only the \Recent flag is set.
  - internaldate: (DateTime) The internaldate to set for the appended
                  message.
                  DEFAULT: internaldate will be the same date as when
                  the message was appended.
$options array Additonal options:
  - create: (boolean) Try to create $mailbox if it does not exist?
            DEFAULT: No.
return Horde_Imap_Client_Ids The UIDs of the appended messages.

capability() public method

Get CAPABILITY information from the IMAP server.
Deprecation: Use $capability property instead.
public capability ( ) : array
return array The capability array.

check() public method

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

close() public method

Close the connection to the currently selected mailbox, optionally expunging all deleted messages (RFC 3501 [6.4.2]).
public close ( array $options = [] )
$options array Additional options: - expunge: (boolean) Expunge all messages flagged as deleted? DEFAULT: No

copy() public method

Copy messages to another mailbox.
public copy ( mixed $source, mixed $dest, array $options = [] ) : mixed
$source mixed The source mailbox. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$dest mixed The destination mailbox. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$options array Additional options: - create: (boolean) Try to create $dest if it does not exist? DEFAULT: No. - force_map: (boolean) Forces the array mapping to always be returned. [@since 2.19.0] - 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.
return mixed An array mapping old UIDs (keys) to new UIDs (values) on success (only guaranteed if 'force_map' is true) or true.

createMailbox() public method

Create a mailbox.
public createMailbox ( mixed $mailbox, array $opts = [] )
$mailbox mixed The mailbox to create. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$opts array Additional options: - special_use: (array) An array of special-use flags to mark the mailbox with. The server MUST support RFC 6154.

currentMailbox() public method

Return the currently opened mailbox and access mode.
public currentMailbox ( ) : mixed
return mixed Null if no mailbox selected, or an array with two elements: - mailbox: (Horde_Imap_Client_Mailbox) The mailbox object. - mode: (integer) Current mode.

deleteACL() public method

Deletes ACL rights for a given mailbox/identifier.
public deleteACL ( mixed $mailbox, string $identifier )
$mailbox mixed A mailbox. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$identifier string The identifier to delete (UTF-8).

deleteMailbox() public method

Delete a mailbox.
public deleteMailbox ( mixed $mailbox )
$mailbox mixed The mailbox to delete. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).

expunge() public method

Expunge deleted messages from the given mailbox.
public expunge ( mixed $mailbox, array $options = [] ) : Horde_Imap_Client_Ids
$mailbox mixed The mailbox to expunge. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$options array Additional options: - delete: (boolean) If true, will flag all messages in 'ids' as deleted (since 2.10.0). DEFAULT: false - ids: (Horde_Imap_Client_Ids) A list of messages to expunge. These messages must already be flagged as deleted (unless 'delete' is true). DEFAULT: All messages marked as deleted will be expunged. - list: (boolean) If true, returns the list of expunged messages (UIDs only). DEFAULT: false
return Horde_Imap_Client_Ids If 'list' option is true, returns the UID list of expunged messages.

fetch() public method

Fetch message data (see RFC 3501 [6.4.5]).
public fetch ( mixed $mailbox, Horde_Imap_Client_Fetch_Query $query, array $options = [] ) : Horde_Imap_Client_Fetch_Results
$mailbox mixed The mailbox to search. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$query Horde_Imap_Client_Fetch_Query Fetch query object.
$options array 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. - exists: (boolean) Ensure that all ids returned exist on the server. If false, the list of ids returned in the results object is not guaranteed to reflect the current state of the remote mailbox. DEFAULT: false - ids: (Horde_Imap_Client_Ids) A list of messages to fetch data from. DEFAULT: All messages in $mailbox will be fetched. - nocache: (boolean) If true, will not cache the results (previously cached data will still be used to generate results) [since 2.8.0]. DEFAULT: false
return Horde_Imap_Client_Fetch_Results A results object.

getACL() public method

Get the ACL rights for a given mailbox. The server must support the IMAP ACL extension (RFC 2086/4314).
public getACL ( mixed $mailbox ) : array
$mailbox mixed A mailbox. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
return array An array with identifiers as the keys and Horde_Imap_Client_Data_Acl objects as the values.

getCache() public method

Returns the Horde_Imap_Client_Cache object used, if available.
public getCache ( ) : mixed
return mixed Either the cache object or null.

getCacheId() public method

Returns a unique identifier for the current mailbox status.
Deprecation:
public getCacheId ( mixed $mailbox, array $addl = [] ) : string
$mailbox mixed A mailbox. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$addl array Additional cache info to add to the cache ID string.
return 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.

getComparator() public method

Get the comparator used for searching/sorting (RFC 5255).
public getComparator ( ) : mixed
return mixed Null if the default comparator is being used, or an array of comparator information (see RFC 5255 [4.8]).

getID() public method

Return ID information from the IMAP server (RFC 2971).
public getID ( ) : array
return array An array of information returned, with the keys as the 'field' and the values as the 'value'.

getIdsOb() public method

Returns the correct IDs object for use with this driver.
public getIdsOb ( mixed $ids = null, boolean $sequence = false ) : Horde_Imap_Client_Ids
$ids mixed See add().
$sequence boolean Are $ids message sequence numbers?
return Horde_Imap_Client_Ids The IDs object.

getLanguage() public method

Gets the preferred language for server response messages (RFC 5255).
public getLanguage ( array $list = false ) : mixed
$list array If true, return the list of available languages.
return 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.

getMetadata() public method

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/).
public getMetadata ( mixed $mailbox, array $entries, array $options = [] ) : array
$mailbox mixed A mailbox. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$entries array The entries to fetch (UTF-8 strings).
$options array 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.
return 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'.

getMyACLRights() public method

Get the ACL rights for the current user for a given mailbox. The server must support the IMAP ACL extension (RFC 2086/4314).
public getMyACLRights ( mixed $mailbox ) : Horde_Imap_Client_Data_Acl
$mailbox mixed A mailbox. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
return Horde_Imap_Client_Data_Acl An ACL data object.

getNamespaces() public method

Get the NAMESPACE information from the IMAP server (RFC 2342).
public getNamespaces ( array $additional = [], array $opts = [] ) : mixed
$additional array 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.
$opts array Additional options: - ob_return: (boolean) If true, returns a Horde_Imap_Client_Namespace_List object instead of an array.
return mixed A Horde_Imap_Client_Namespace_List object if 'ob_return', is true. Otherwise, an array of namespace objects (@deprecated) with the name as the key (UTF-8) and the following values:
 - delimiter: (string) The namespace delimiter.
 - hidden: (boolean) Is this a hidden namespace?
 - name: (string) The namespace name (UTF-8).
 - 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

getParam() public method

Returns a value from the internal params array.
public getParam ( string $key ) : mixed
$key string The param key.
return mixed The param value, or null if not found.

getQuota() public method

Get quota limits. The server must support the IMAP QUOTA extension (RFC 2087).
public getQuota ( mixed $root ) : mixed
$root mixed The quota root. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
return mixed An array with resource keys. Each key holds an array with 2 values: 'limit' and 'usage'.

getQuotaRoot() public method

Get quota limits for a mailbox. The server must support the IMAP QUOTA extension (RFC 2087).
public getQuotaRoot ( mixed $mailbox ) : mixed
$mailbox mixed A mailbox. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
return 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'.

getSyncToken() public method

Returns a unique token for the current mailbox synchronization status.
Since: 2.2.0
public getSyncToken ( mixed $mailbox ) : string
$mailbox mixed A mailbox. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
return string The sync token.

isSecureConnection() public method

Display if connection to the server has been secured via TLS or SSL.
public isSecureConnection ( ) : boolean
return boolean True if the IMAP connection is secured.

listACLRights() public method

List the ACL rights for a given mailbox/identifier. The server must support the IMAP ACL extension (RFC 2086/4314).
public listACLRights ( mixed $mailbox, string $identifier ) : Horde_Imap_Client_Data_AclRights
$mailbox mixed A mailbox. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$identifier string The identifier to query (UTF-8).
return Horde_Imap_Client_Data_AclRights An ACL data rights object.

listMailboxes() public method

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: '.'
return 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].

login() public method

Login to the IMAP server.
public login ( )

logout() public method

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

noop() public method

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

openMailbox() public method

Open a mailbox.
public openMailbox ( mixed $mailbox, integer $mode = Horde_Imap_Client::OPEN_AUTO )
$mailbox mixed The mailbox to open. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$mode integer The access mode. Either - Horde_Imap_Client::OPEN_READONLY - Horde_Imap_Client::OPEN_READWRITE - Horde_Imap_Client::OPEN_AUTO

parseCacheId() public method

Parses a cacheID created by getCacheId().
Deprecation:
public parseCacheId ( string $id ) : array
$id string The cache ID.
return array An array with the following information: - highestmodseq: (integer) - messages: (integer) - uidnext: (integer) - uidvalidity: (integer) Always present

queryCapability() public method

Returns whether the IMAP server supports the given capability (See RFC 3501 [6.1.1]).
Deprecation: Use $capability property instead.
public queryCapability ( string $capability ) : mixed
$capability string The capability string to query.
return mixed True if the server supports the queried capability, false if it doesn't, or an array if the capability can contain multiple values.

renameMailbox() public method

Rename a mailbox.
public renameMailbox ( mixed $old, mixed $new )
$old mixed The old mailbox name. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$new mixed The new mailbox name. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).

resolveIds() public method

Resolves an IDs object into a list of IDs.
public resolveIds ( Horde_Imap_Client_Mailbox $mailbox, Horde_Imap_Client_Ids $ids, integer $convert ) : Horde_Imap_Client_Ids
$mailbox Horde_Imap_Client_Mailbox The mailbox.
$ids Horde_Imap_Client_Ids The Ids object.
$convert integer Convert to UIDs? - 0: No - 1: Only if $ids is not already a UIDs object - 2: Always
return Horde_Imap_Client_Ids The list of IDs.

sendID() public method

Send ID information to the IMAP server (RFC 2971).
public sendID ( array $info = null )
$info array Overrides the value of the 'id' param and sends this information instead.

serialize() public method

public serialize ( )

setACL() public method

Set ACL rights for a given mailbox/identifier.
public setACL ( mixed $mailbox, string $identifier, array $options )
$mailbox mixed A mailbox. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$identifier string The identifier to alter (UTF-8).
$options array Additional options: - rights: (string) The rights to alter or set. - action: (string, optional) If 'add' or 'remove', adds or removes the specified rights. Sets the rights otherwise.

setComparator() public method

Set the comparator to use for searching/sorting (RFC 5255).
public setComparator ( string $comparator = null )
$comparator string The comparator string (see RFC 4790 [3.1] - "collation-id" - for format). The reserved string 'default' can be used to select the default comparator.

setLanguage() public method

Sets the preferred language for server response messages (RFC 5255).
public setLanguage ( array $langs = null ) : string
$langs array 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.
return string The language accepted by the server, or null if the default language is used.

setMetadata() public method

Set metadata for a given mailbox/identifier.
public setMetadata ( mixed $mailbox, array $data )
$mailbox mixed A mailbox. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8). If empty, sets a server annotation.
$data array A set of data values. The metadata values corresponding to the keys of the array will be set to the values in the array.

setParam() public method

Sets a configuration parameter value.
public setParam ( string $key, mixed $val )
$key string The param key.
$val mixed The param value.

setQuota() public method

Set quota limits. The server must support the IMAP QUOTA extension (RFC 2087).
public setQuota ( mixed $root, array $resources = [] )
$root mixed The quota root. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$resources array The resource values to set. Keys are the resource atom name; value is the resource value.

shutdown() public method

Shutdown actions.
public shutdown ( )

status() public method

Obtain status information for a mailbox.
public status ( mixed $mailbox, integer $flags = Horde_Imap_Client::STATUS_ALL, array $opts = [] ) : array
$mailbox mixed The mailbox(es) to query. Either a Horde_Imap_Client_Mailbox object, a string (UTF-8), or an array of objects/strings (since 2.10.0).
$flags integer A bitmask of information requested from the server. Allowed flags:
  - Horde_Imap_Client::STATUS_MESSAGES
    Return key: messages
    Return format: (integer) The number of messages in the mailbox.

  - Horde_Imap_Client::STATUS_RECENT
    Return key: recent
    Return format: (integer) The number of messages with the \Recent
                   flag set as currently reported in the mailbox

  - Horde_Imap_Client::STATUS_RECENT_TOTAL
    Return key: recent_total
    Return format: (integer) The number of messages with the \Recent
                   flag set. This returns the total number of messages
                   that have been marked as recent in this mailbox
                   since the PHP process began. (since 2.12.0)

  - Horde_Imap_Client::STATUS_UIDNEXT
    Return key: uidnext
    Return format: (integer) The next UID to be assigned in the
                   mailbox. Only returned if the server automatically
                   provides the data.

  - Horde_Imap_Client::STATUS_UIDNEXT_FORCE
    Return key: uidnext
    Return format: (integer) The next UID to be assigned in the
                   mailbox. This option will always determine this
                   value, even if the server does not automatically
                   provide this data.

  - Horde_Imap_Client::STATUS_UIDVALIDITY
    Return key: uidvalidity
    Return format: (integer) The unique identifier validity of the
                   mailbox.

  - Horde_Imap_Client::STATUS_UNSEEN
    Return key: unseen
    Return format: (integer) The number of messages which do not have
                   the \Seen flag set.

  - Horde_Imap_Client::STATUS_FIRSTUNSEEN
    Return key: firstunseen
    Return format: (integer) The sequence number of the first unseen
                   message in the mailbox.

  - Horde_Imap_Client::STATUS_FLAGS
    Return key: flags
    Return format: (array) The list of defined flags in the mailbox
                   (all flags are in lowercase).

  - Horde_Imap_Client::STATUS_PERMFLAGS
    Return key: permflags
    Return format: (array) The list of flags that a client can change
                   permanently (all flags are in lowercase).

  - Horde_Imap_Client::STATUS_HIGHESTMODSEQ
    Return key: highestmodseq
    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.

  - Horde_Imap_Client::STATUS_SYNCMODSEQ
    Return key: syncmodseq
    Return format: (integer) If caching, and the server supports the
                   CONDSTORE IMAP extension, this is the cached
                   mod-sequence value of the mailbox when it was opened
                   for the first time in this access. Will be null if
                   not caching, CONDSTORE not available, or the mailbox
                   does not support mod-sequences.

  - Horde_Imap_Client::STATUS_SYNCFLAGUIDS
    Return key: syncflaguids
    Return format: (Horde_Imap_Client_Ids) If caching, the server
                   supports the CONDSTORE IMAP extension, and the
                   mailbox contained cached data when opened for the
                   first time in this access, this is the list of UIDs
                   in which flags have changed since STATUS_SYNCMODSEQ.

  - Horde_Imap_Client::STATUS_SYNCVANISHED
    Return key: syncvanished
    Return format: (Horde_Imap_Client_Ids) If caching, the server
                   supports the CONDSTORE IMAP extension, and the
                   mailbox contained cached data when opened for the
                   first time in this access, this is the list of UIDs
                   which have been deleted since STATUS_SYNCMODSEQ.

  - Horde_Imap_Client::STATUS_UIDNOTSTICKY
    Return key: uidnotsticky
    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.

  - Horde_Imap_Client::STATUS_FORCE_REFRESH
    Normally, the status information will be cached for a given
    mailbox. Since most PHP requests are generally less than a second,
    this is fine. However, if your script is long running, the status
    information may not be up-to-date. Specifying this flag will ensure
    that the server is always polled for the current mailbox status
    before results are returned. (since 2.14.0)

  - Horde_Imap_Client::STATUS_ALL (DEFAULT)
    Shortcut to return 'messages', 'recent', 'uidnext', 'uidvalidity',
    and 'unseen' values.
$opts array Additional options:
  - sort: (boolean) If true, sort the list of mailboxes? (since 2.10.0)
          DEFAULT: Do not sort the list.
  - sort_delimiter: (string) If 'sort' is true, this is the delimiter
                    used to sort the mailboxes. (since 2.10.0)
                    DEFAULT: '.'
return array If $mailbox contains multiple mailboxes, an array with keys being the UTF-8 mailbox name and values as arrays containing the requested keys (see above). Otherwise, an array with keys as the requested keys (see above) and values as the key data.

statusMultiple() public method

This method leverages the LIST-EXTENDED and LIST-STATUS extensions on the IMAP server to improve the efficiency of this operation.
Deprecation: Use status() instead.
public statusMultiple ( array $mailboxes, integer $flags = Horde_Imap_Client::STATUS_ALL, array $opts = [] ) : array
$mailboxes array The mailboxes to query. Either Horde_Imap_Client_Mailbox objects, strings (UTF-8), or a combination of the two.
$flags integer See status().
$opts array 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: '.'
return array An array with the keys as the mailbox names (UTF-8) and the values as arrays with the requested keys (from the mask given in $flags).

store() public method

Store message flag data (see RFC 3501 [6.4.6]).
public store ( mixed $mailbox, array $options = [] ) : Horde_Imap_Client_Ids
$mailbox mixed The mailbox containing the messages to modify. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$options array 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
return Horde_Imap_Client_Ids A Horde_Imap_Client_Ids object containing the list of IDs that failed the 'unchangedsince' test.

subscribeMailbox() public method

Manage subscription status for a mailbox.
public subscribeMailbox ( mixed $mailbox, boolean $subscribe = true )
$mailbox mixed The mailbox to [un]subscribe to. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$subscribe boolean True to subscribe, false to unsubscribe.

sync() public method

Synchronize a mailbox from a sync token.
Since: 2.2.0
public sync ( mixed $mailbox, string $token, array $opts = [] ) : Horde_Imap_Client_Data_Sync
$mailbox mixed A mailbox. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$token string A sync token generated by getSyncToken().
$opts array Additional options: - criteria: (integer) Mask of Horde_Imap_Client::SYNC_* criteria to return. Defaults to SYNC_ALL. - ids: (Horde_Imap_Client_Ids) A cached list of UIDs. Unless QRESYNC is available on the server, failure to specify this option means SYNC_VANISHEDUIDS information cannot be returned.
return Horde_Imap_Client_Data_Sync A sync object.

thread() public method

Thread sort a given list of messages (RFC 5256).
public thread ( mixed $mailbox, array $options = [] ) : Horde_Imap_Client_Data_Thread
$mailbox mixed The mailbox to query. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$options array Additional options:
  - criteria: (mixed) The following thread criteria are available:
    - Horde_Imap_Client::THREAD_ORDEREDSUBJECT
    - Horde_Imap_Client::THREAD_REFERENCES
    - Horde_Imap_Client::THREAD_REFS
      Other algorithms can be explicitly specified by passing the IMAP
      thread algorithm in as a string value.
    DEFAULT: Horde_Imap_Client::THREAD_ORDEREDSUBJECT
  - search: (Horde_Imap_Client_Search_Query) The search query.
            DEFAULT: All messages in mailbox included in thread sort.
  - sequence: (boolean) If true, each message is stored and referred to
              by its message sequence number.
              DEFAULT: Stored/referred to by UID.
return Horde_Imap_Client_Data_Thread A thread data object.

unserialize() public method

public unserialize ( $data )

update() public method

public update ( SplSubject $subject )
$subject SplSubject

validSearchCharset() public method

This check pertains just to the basic IMAP SEARCH command.
Deprecation: Use $search_charset property instead.
public validSearchCharset ( string $charset ) : boolean
$charset string The query charset.
return boolean True if server supports this charset.

vanished() public method

Get the list of vanished messages (UIDs that have been expunged since a given mod-sequence value).
public vanished ( mixed $mailbox, integer $modseq, array $opts = [] ) : Horde_Imap_Client_Ids
$mailbox mixed The mailbox to query. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$modseq integer Search for expunged messages after this mod-sequence value.
$opts array Additional options: - ids: (Horde_Imap_Client_Ids) Restrict to these UIDs. DEFAULT: Returns full list of UIDs vanished (QRESYNC only). This option is REQUIRED for non-QRESYNC servers or else an empty list will be returned.
return Horde_Imap_Client_Ids List of UIDs that have vanished.

Property Details

$_alerts protected property

Alerts reporting object.
protected Horde_Imap_Client_Base_Alerts $_alerts
return Horde_Imap_Client_Base_Alerts

$_cache protected property

The Horde_Imap_Client_Cache object.
protected Horde_Imap_Client_Cache $_cache
return Horde_Imap_Client_Cache

$_connection protected property

Connection to the IMAP server.
protected Horde\Socket\Client $_connection
return Horde\Socket\Client

$_debug protected property

The debug object.
protected Horde_Imap_Client_Base_Debug $_debug
return Horde_Imap_Client_Base_Debug

$_defaultPorts protected property

First element is non-secure, second is SSL.
protected array $_defaultPorts
return array

$_fetchDataClass protected property

The fetch data object type to return.
protected string $_fetchDataClass
return string

$_init protected property

Cached server data.
protected array $_init
return array

$_isAuthenticated protected property

Is there an active authenticated connection to the IMAP Server?
protected bool $_isAuthenticated
return boolean

$_mode protected property

The current mailbox selection mode.
protected int $_mode
return integer

$_params protected property

This hash never changes.
protected array $_params
return array

$_selected protected property

The currently selected mailbox.
protected Horde_Imap_Client_Mailbox $_selected
return Horde_Imap_Client_Mailbox

$_temp protected property

Temp array (destroyed at end of process).
protected array $_temp
return array

$cacheFields public property

The list of fetch fields that can be cached, and their cache names.
public array $cacheFields
return array

$changed public property

Has the internal configuration changed?
public bool $changed
return boolean

$statuscache public property

Horde_Imap_Client is optimized for short (i.e. 1 seconds) scripts. It makes heavy use of mailbox caching to save on server accesses. This property should be set to false for long-running scripts, or else status() data may not reflect the current state of the mailbox on the server.
Since: 2.14.0
public bool $statuscache
return boolean