Constants

MAX_FETCH

MAX_FETCH

Maximum number of of messages to fetch from the IMAP server in one go.

Properties

$_logger

$_logger : \Horde_Log_Logger

Type

\Horde_Log_Logger

$_defaultNamespace

$_defaultNamespace : string

Type

string

$_procid

$_procid : integer

Process id used for logging.

Type

integer

Methods

__construct()

__construct(array  $params = array()) 

Cont'r

Parameters

array $params

Parameters:

  • factory: (Horde_ActiveSync_Interface_ImapFactory) Factory object DEFAULT: none - REQUIRED

appendMessage()

appendMessage(string  $folderid, string|\stream  $msg, array  $flags = array()) : integer|boolean

Append a message to the specified mailbox. Used for saving sent email.

Parameters

string $folderid

The mailbox

string|\stream $msg

The message

array $flags

Any flags to set on the newly appended message.

Throws

\new

Horde_ActiveSync_Exception, Horde_ActiveSync_Exception_FolderGone

Returns

integer|boolean —

The imap uid of the appended message or false on failure. @since 2.37.0

createMailbox()

createMailbox(string  $name, string  $parent = null) 

Create a new mailbox on the server, and subscribe to it.

Parameters

string $name

The new mailbox name.

string $parent

The parent mailbox, if any.

@return string The new serverid for the mailbox. This is the UTF-8 name of the mailbox. @since 2.9.0 @throws Horde_ActiveSync_Exception, Horde_ActiveSync_Exception_FolderExists

deleteMailbox()

deleteMailbox(string  $name) 

Delete a mailbox

Parameters

string $name

The mailbox name to delete.

Throws

\Horde_ActiveSync_Exception,

Horde_ActiveSync_Exception_FolderGone

emptyMailbox()

emptyMailbox(string  $mbox) 

Completely empty specified mailbox.

Parameters

string $mbox

The mailbox to empty.

Throws

\Horde_ActiveSync_Exception

deleteMessages()

deleteMessages(array  $uids, string  $folderid) : array

Permanently delete a mail message.

Parameters

array $uids

The message UIDs

string $folderid

The folder id.

Throws

\Horde_ActiveSync_Exception

Returns

array —

An array of uids that were successfully deleted.

getAttachment()

getAttachment(string  $mailbox, string  $uid, string  $part) : \Horde_Mime_Part

Return the content of a specific MIME part of the specified message.

Parameters

string $mailbox

The mailbox name.

string $uid

The message UID.

string $part

The MIME part identifier.

Throws

\Horde_ActiveSync_Exception

Returns

\Horde_Mime_Part —

The attachment data

getMailboxes()

getMailboxes() : array

Return an array of available mailboxes. Uses's the mail/mailboxList API method for obtaining the list.

Returns

array

getSpecialMailboxes()

getSpecialMailboxes() : array

Return the list of special mailboxes.

Returns

array

getImapMessage()

getImapMessage(string  $mailbox, array|integer  $uid, array  $options = array()) : array

Return a complete Horde_ActiveSync_Imap_Message object for the requested uid.

Parameters

string $mailbox

The mailbox name.

array|integer $uid

The message uid.

array $options

Additional options:

  • headers: (boolean) Also fetch the message headers if this is true. DEFAULT: false (Do not fetch headers).

Returns

array —

An array of Horde_ActiveSync_Imap_Message objects.

getMessageChanges()

getMessageChanges(\Horde_ActiveSync_Folder_Imap  $folder, array  $options = array()) : \Horde_ActiveSync_Folder_Imap

Return message changes from the specified mailbox.

Parameters

\Horde_ActiveSync_Folder_Imap $folder

The folder object.

array $options

Additional options:

  • sincedate: (integer) Timestamp of earliest message to retrieve. DEFAULT: 0 (Don't filter).
  • protocolversion: (float) EAS protocol version to support. DEFAULT: none REQUIRED
  • softdelete: (boolean) If true, calculate SOFTDELETE data. @since 2.8.0
  • refreshfilter: (boolean) If true, force refresh the query to reflect changes in FILTERTYPE (using the sincedate) @since 2.28.0

Throws

\Horde_ActiveSync_Exception_FolderGone,

Horde_ActiveSync_Exception, Horde_ActiveSync_Exception_StaleState

Returns

\Horde_ActiveSync_Folder_Imap

The folder object, containing any change instructions for the device.

getMessages()

getMessages(string  $folderid, array  $messages, array  $options = array()) : array

Return AS mail messages, from the given IMAP UIDs.

Parameters

string $folderid

The mailbox folder.

array $messages

List of IMAP message UIDs

array $options

Additional Options:

  • truncation: (integer) The truncation constant, if sent from device. DEFAULT: false (No truncation).
  • bodyprefs: (array) The bodypref settings, if sent from device. DEFAULT: none (No body prefs sent, or enforced).
  • bodypartprefs: (array) The bodypartprefs settings, if present.
  • mimesupport: (integer) Indicates if MIME is supported or not. Possible values: 0 - Not supported 1 - Only S/MIME or 2 - All MIME. DEFAULT: 0 (No MIME support)
  • protocolversion: (float) The EAS protocol version to support. DEFAULT: 2.5

Returns

array —

An array of Horde_ActiveSync_Message_Mail objects.

getUidFromMid()

getUidFromMid(string  $mid, \Horde_ActiveSync_Folder_Imap  $folder) : integer

Return a message UIDs from the given Message-ID.

Parameters

string $mid

The Message-ID

\Horde_ActiveSync_Folder_Imap $folder

The folder object to search.

Throws

\Horde_Exception_NotFound

Returns

integer —

The UID

getUidFromMidInFolders()

getUidFromMidInFolders(  $id, array  $folders) : array

Attempt to find a Message-ID in a list of mail folders.

Parameters

$id
array $folders

Throws

\Horde_Exception_NotFound,

Horde_ActiveSync_Exception

Returns

array —

An array with the 0 element being the mbox

moveMessage()

moveMessage(string  $folderid, array  $ids, string  $newfolderid) : array

Move a mail message

Parameters

string $folderid

The existing folderid.

array $ids

The message UIDs of the messages to move.

string $newfolderid

The folder id to move $id to.

Throws

\Horde_ActiveSync_Exception

Returns

array —

An hash of oldUID => newUID.

ping()

ping(\Horde_ActiveSync_Folder_Imap  $folder) : boolean

Ping a mailbox. This detects only if any new messages have arrived in the specified mailbox.

Parameters

\Horde_ActiveSync_Folder_Imap $folder

The folder object.

Throws

\Horde_ActiveSync_Exception,

Horde_ActiveSync_Exception_FolderGone

Returns

boolean —

True if changes were detected, otherwise false.

queryMailbox()

queryMailbox(array  $query) : array

Perform a search from a search mailbox request.

Parameters

array $query

The query array.

Returns

array —

An array of 'uniqueid', 'searchfolderid' hashes.

renameMailbox()

renameMailbox(string  $old, string  $new, string  $parent = null) : string

Rename a mailbox

Parameters

string $old

The old mailbox name.

string $new

The new mailbox name.

string $parent

The parent mailbox, if any.

Throws

\Horde_ActiveSync_Exception

Returns

string —

The new serverid for the mailbox. @since 2.9.0

setImapFlag()

setImapFlag(string  $mailbox, integer  $uid, string  $flag) 

Set a IMAP message flag.

Parameters

string $mailbox

The mailbox name.

integer $uid

The message UID.

string $flag

The flag to set. A Horde_ActiveSync:: constant.

Throws

\Horde_ActiveSync_Exception

setLogger()

setLogger(\Horde_Log_Logger  $logger) 

Set this instance's logger.

Parameters

\Horde_Log_Logger $logger

The logger.

setMessageFlag()

setMessageFlag(string  $mailbox, integer  $uid, \Horde_ActiveSync_Message_Flag  $flag) 

Set a POOMMAIL_FLAG on a mail message. This method differs from setReadFlag() in that it is passed a Flag object, which contains other data beside the seen status. Used for setting flagged for followup and potentially creating tasks based on the email.

Parameters

string $mailbox

The mailbox name.

integer $uid

The message uid.

\Horde_ActiveSync_Message_Flag $flag

The flag

Throws

\Horde_ActiveSync_Exception

categoriesToFlags()

categoriesToFlags(  $mailbox,   $categories,   $uid) 

Parameters

$mailbox
$categories
$uid

setReadFlag()

setReadFlag(string  $mailbox, string  $uid, integer  $flag) 

Set the message's read status.

Parameters

string $mailbox

The mailbox name.

string $uid

The message uid.

integer $flag

Horde_ActiveSync_MessageMail::FLAG* constant

Throws

\Horde_ActiveSync_Exception

_buildSubQuery()

_buildSubQuery(array  $query) : \Horde_Imap_Client_Search_Query

Helper to build a subquery

Parameters

array $query

A subquery array.

Returns

\Horde_Imap_Client_Search_Query —

The query object.

_buildMailMessage()

_buildMailMessage(\Horde_Imap_Client_Mailbox  $mbox, \Horde_Imap_Client_Data_Fetch  $data, array  $options = array()) : \Horde_ActiveSync_Message_Mail

Builds a proper AS mail message object.

Parameters

\Horde_Imap_Client_Mailbox $mbox

The IMAP mailbox.

\Horde_Imap_Client_Data_Fetch $data

The fetch results.

array $options

Additional Options:

  • truncation: (integer) Truncate the message body to this length. DEFAULT: No truncation.
  • bodyprefs: (array) Bodyprefs, if sent from device. DEFAULT: none (No body prefs sent or enforced).
  • bodypartprefs: (array) Bodypartprefs, if sent from device. DEFAULT: none (No body part prefs sent or enforced).
  • mimesupport: (integer) Indicates if MIME is supported or not. Possible values: 0 - Not supported 1 - Only S/MIME or 2 - All MIME. DEFAULT: 0 (No MIME support)
  • protocolversion: (float) The EAS protocol version to support. DEFAULT: 2.5

Returns

\Horde_ActiveSync_Message_Mail

The message object suitable for streaming to the device.

_prependNamespace()

_prependNamespace(string  $name) : string

Prefix the default namespace to mailbox name if needed.

Parameters

string $name

The mailbox name.

Returns

string —

The mailbox name with the default namespace added, if needed.

_defaultNamespace()

_defaultNamespace() : array

Return the default namespace.

Returns

array —

The namespace data.

_getNamespacelist()

_getNamespacelist() : array

Return the list of configured namespaces on the IMAP server.

Returns

array

_getNamespace()

_getNamespace(  $path) 

Parameters

$path

_doQuery()

_doQuery(array  $query) : array

Perform an IMAP search based on a SEARCH request.

Parameters

array $query

The search query.

Throws

\Horde_ActiveSync_Exception

Returns

array —

The results array containing an array of hashes: 'uniqueid' => [The unique identifier of the result] 'searchfolderid' => [The mailbox name that this result comes from]

_getImapOb()

_getImapOb() : \Horde_Imap_Client_Base

Helper to obtain a valid IMAP client. Can't inject it since the user is not yet authenticated at the time of object creation.

Throws

\Horde_ActiveSync_Exception

Returns

\Horde_Imap_Client_Base

_getMailMessages()

_getMailMessages(\Horde_Imap_Client_Mailbox  $mbox, array  $uids, array  $options = array()) : \Horde_Imap_Fetch_Results

Parameters

\Horde_Imap_Client_Mailbox $mbox

The mailbox

array $uids

An array of message uids

array $options

An options array

  • headers: (boolean) Fetch header text if true. DEFAULT: false (Do not fetch header text).
  • structure: (boolean) Fetch message structure. DEFAULT: true (Fetch message structure).
  • flags: (boolean) Fetch messagge flags. DEFAULT: true (Fetch message flags).
  • envelope: (boolen) Fetch the envelope data. DEFAULT: false (Do not fetch envelope). @since 2.4.0

Throws

\Horde_ActiveSync_Exception

Returns

\Horde_Imap_Fetch_Results —

The results.

_mailboxExists()

_mailboxExists(string  $mbox) : boolean

Check existence of a mailbox.

Parameters

string $mbox

The mailbox name.

Returns

boolean

_getMsgFlags()

_getMsgFlags()