Documentation

IMP_Imap
in package
implements Serializable

Provides common functions for interaction with IMAP/POP3 servers via the Horde_Imap_Client package.

Tags
author

Michael Slusarz slusarz@horde.org

category

Horde

copyright

2008-2017 Horde LLC

license

http://www.horde.org/licenses/gpl GPL

Table of Contents

Interfaces

Serializable

Constants

ACCESS_ACL  = 10
ACCESS_COMPOSE_BODYSIZE  = 13
ACCESS_COMPOSE_RECIPIENTS  = 8
ACCESS_COMPOSE_TIMELIMIT  = 9
ACCESS_CREATEMBOX  = 6
ACCESS_CREATEMBOX_MAX  = 7
ACCESS_DRAFTS  = 11
ACCESS_FLAGS  = 3
ACCESS_FOLDERS  = 1
ACCESS_IMPORT  = 14
ACCESS_REMOTE  = 12
ACCESS_SEARCH  = 2
ACCESS_SORT  = 15
ACCESS_TRASH  = 5
ACCESS_UNSEEN  = 4
NS_DEFAULT  = "\x00default"

Properties

$changed  : bool
$client_ob  : Horde_Imap_Client_Base
$config  : IMP_Imap_Config
$init  : bool
$max_compose_bodysize  : int
$max_compose_recipients  : int
$max_compose_timelimit  : int
$max_create_mboxes  : int
$server_key  : string
$thread_algo  : string
$url  : Horde_Imap_Client_Url
$_backends  : array<string|int, mixed>
Cached backend configuration.
$_changed  : bool
Has this object changed?
$_config  : IMP_Imap_Config
Backend config.
$_id  : string
Object identifier.
$_ob  : Horde_Imap_Client_Base
The IMAP client object.
$_temp  : array<string|int, mixed>
Temporary data cache (destroyed at end of request).

Methods

__call()  : mixed
All other calls to this class are routed to the underlying Horde_Imap_Client_Base object.
__construct()  : mixed
Constructor.
__get()  : mixed
__serialize()  : array<string|int, mixed>
__toString()  : mixed
__unserialize()  : void
access()  : bool
Checks access rights for a server.
accessCompose()  : bool
Checks compose access rights for a server.
createBaseImapObject()  : Horde_Imap_Client_Base
Create the base Horde_Imap_Client object (from an entry in backends.php).
createImapObject()  : Horde_Imap_Client_Base
Create a Horde_Imap_Client object.
doPostLoginTasks()  : mixed
Perform post-login tasks.
getCacheId()  : string
Return the cache ID for this mailbox.
getNamespace()  : mixed
Get namespace info for a full mailbox path.
getSlices()  : array<string|int, mixed>
Returns a list of messages, split into slices based on the total message size.
isImap()  : bool
Determine if this is a connection to an IMAP server.
isPop3()  : bool
Determine if this is a connection to an IMAP server.
loadServerConfig()  : mixed
Loads the IMP server configuration from backends.php.
parseCacheId()  : array<string|int, mixed>
Parses the cache ID for this mailbox.
serialize()  : mixed
unserialize()  : mixed
updateFetchIgnore()  : mixed
Update the list of mailboxes to ignore when caching FETCH data in the IMAP client object.
_copy()  : mixed
Handle copy() calls that hit multiple servers.
_getPerm()  : string
Get the full permission name for a permission.
_renameMailbox()  : mixed
Handle copy() calls. This call may hit multiple servers, so need to handle separately from other IMAP calls.
_search()  : array<string|int, mixed>
Prepares an IMAP search query. Needed because certain configuration parameters may need to be dynamically altered before passed to the Imap_Client object.
_status()  : mixed
Handle status() calls. This call may hit multiple servers.

Constants

ACCESS_ACL

public mixed ACCESS_ACL = 10

ACCESS_COMPOSE_BODYSIZE

public mixed ACCESS_COMPOSE_BODYSIZE = 13

ACCESS_COMPOSE_RECIPIENTS

public mixed ACCESS_COMPOSE_RECIPIENTS = 8

ACCESS_COMPOSE_TIMELIMIT

public mixed ACCESS_COMPOSE_TIMELIMIT = 9

ACCESS_CREATEMBOX

public mixed ACCESS_CREATEMBOX = 6

ACCESS_CREATEMBOX_MAX

public mixed ACCESS_CREATEMBOX_MAX = 7

ACCESS_DRAFTS

public mixed ACCESS_DRAFTS = 11

ACCESS_FLAGS

public mixed ACCESS_FLAGS = 3

ACCESS_FOLDERS

public mixed ACCESS_FOLDERS = 1

ACCESS_IMPORT

public mixed ACCESS_IMPORT = 14

ACCESS_REMOTE

public mixed ACCESS_REMOTE = 12
public mixed ACCESS_SEARCH = 2

ACCESS_SORT

public mixed ACCESS_SORT = 15

ACCESS_TRASH

public mixed ACCESS_TRASH = 5

ACCESS_UNSEEN

public mixed ACCESS_UNSEEN = 4

NS_DEFAULT

public mixed NS_DEFAULT = "\x00default"

Properties

$changed read-only

public bool $changed

If true, this object has changed.

$client_ob read-only

public Horde_Imap_Client_Base $client_ob

The IMAP client object.

$init read-only

public bool $init

Has the IMAP object been initialized?

$max_compose_bodysize read-only

public int $max_compose_bodysize

The maximum size (in bytes) of the compose message body.

$max_compose_recipients read-only

public int $max_compose_recipients

The maximum number of recipients to send to per compose message.

$max_compose_timelimit read-only

public int $max_compose_timelimit

The maximum number of recipients to send to in the configured timelimit.

$max_create_mboxes read-only

public int $max_create_mboxes

The maximum number of mailboxes a user can create.

$server_key read-only

public string $server_key

Server key used to login.

$thread_algo read-only

public string $thread_algo

The threading algorithm to use.

$url read-only

public Horde_Imap_Client_Url $url

A URL object.

$_backends

Cached backend configuration.

protected static array<string|int, mixed> $_backends = array()

$_changed

Has this object changed?

protected bool $_changed = \false

$_id

Object identifier.

protected string $_id

$_ob

The IMAP client object.

protected Horde_Imap_Client_Base $_ob

$_temp

Temporary data cache (destroyed at end of request).

protected array<string|int, mixed> $_temp = array()

Methods

__call()

All other calls to this class are routed to the underlying Horde_Imap_Client_Base object.

public __call(string $method, array<string|int, mixed> $params) : mixed
Parameters
$method : string

Method name.

$params : array<string|int, mixed>

Method parameters.

Tags
throws
BadMethodCallException
throws
IMP_Imap_Exception
Return values
mixed

The return from the requested method.

__construct()

Constructor.

public __construct(string $id) : mixed
Parameters
$id : string

Object identifier.

__get()

public __get(mixed $key) : mixed
Parameters
$key : mixed

__serialize()

public __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__toString()

public __toString() : mixed

__unserialize()

public __unserialize(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>

access()

Checks access rights for a server.

public access(int $right) : bool
Parameters
$right : int

Access right.

Return values
bool

Does the access right exist?

accessCompose()

Checks compose access rights for a server.

public accessCompose(int $right, int $data) : bool
Parameters
$right : int

Access right.

$data : int

Data required to check the rights:

  • ACCESS_COMPOSE_BODYSIZE The size of the body data.

  • ACCESS_COMPOSE_RECIPIENTS

  • ACCESS_COMPOSE_TIMELIMIT The number of e-mail recipients.

Return values
bool

Is the access allowed?

createBaseImapObject()

Create the base Horde_Imap_Client object (from an entry in backends.php).

public createBaseImapObject(string $username, string $password, string $skey) : Horde_Imap_Client_Base
Parameters
$username : string

The username to authenticate with.

$password : string

The password to authenticate with.

$skey : string

Create a new object using this server key.

Tags
throws
IMP_Imap_Exception
Return values
Horde_Imap_Client_Base

Client object.

createImapObject()

Create a Horde_Imap_Client object.

public createImapObject(array<string|int, mixed> $config[, bool $imap = true ]) : Horde_Imap_Client_Base
Parameters
$config : array<string|int, mixed>

The IMAP configuration.

$imap : bool = true

True if IMAP connection, false if POP3.

Tags
throws
IMP_Imap_Exception
Return values
Horde_Imap_Client_Base

Client object.

doPostLoginTasks()

Perform post-login tasks.

public doPostLoginTasks() : mixed

getCacheId()

Return the cache ID for this mailbox.

public getCacheId(string $mailbox[, array<string|int, mixed> $addl = array() ]) : string
Parameters
$mailbox : string

The mailbox name (UTF-8).

$addl : array<string|int, mixed> = array()

Local IMP metadata to add to the cache ID.

Return values
string

The cache ID.

getNamespace()

Get namespace info for a full mailbox path.

public getNamespace(string $mailbox[, bool $personal = false ]) : mixed
Parameters
$mailbox : string

The mailbox path. (self:NS_DEFAULT will return the default personal namespace.)

$personal : bool = false

If true, will return empty namespace only if it is a personal namespace.

Return values
mixed

The namespace info for the mailbox path or null if the path doesn't exist.

getSlices()

Returns a list of messages, split into slices based on the total message size.

public getSlices(string $mbox, Horde_Imap_Client_Ids $ids[, int $size = 5242880 ]) : array<string|int, mixed>
Parameters
$mbox : string

IMAP mailbox.

$ids : Horde_Imap_Client_Ids

ID list.

$size : int = 5242880

Maximum size of a slice.

Return values
array<string|int, mixed>

An array of Horde_Imap_Client_Ids objects.

isImap()

Determine if this is a connection to an IMAP server.

public isImap() : bool
Return values
bool

True if connected to IMAP server.

isPop3()

Determine if this is a connection to an IMAP server.

public isPop3() : bool
Return values
bool

True if connected to IMAP server.

loadServerConfig()

Loads the IMP server configuration from backends.php.

public static loadServerConfig([string $server = null ]) : mixed
Parameters
$server : string = null

Returns this labeled entry only.

Return values
mixed

If $server is set return this entry; else, return the entire servers array. Returns false on error.

parseCacheId()

Parses the cache ID for this mailbox.

public parseCacheId(string $id) : array<string|int, mixed>
Parameters
$id : string

Cache ID generated by getCacheId().

Return values
array<string|int, mixed>

Two element array:

  • date: (integer) Date information (day of year), if embedded in cache ID.
  • token: (string) Mailbox sync token.

serialize()

public serialize() : mixed

unserialize()

public unserialize(mixed $data) : mixed
Parameters
$data : mixed
Tags
throws
Horde_Pack_Exception

updateFetchIgnore()

Update the list of mailboxes to ignore when caching FETCH data in the IMAP client object.

public updateFetchIgnore() : mixed

_copy()

Handle copy() calls that hit multiple servers.

protected _copy() : mixed
Tags
see

Horde_Imap_Client_Base#copy()

_getPerm()

Get the full permission name for a permission.

protected _getPerm(string $perm) : string
Parameters
$perm : string

The permission.

Return values
string

The full (backend-specific) permission name.

_renameMailbox()

Handle copy() calls. This call may hit multiple servers, so need to handle separately from other IMAP calls.

protected _renameMailbox() : mixed
Tags
see

Horde_Imap_Client_Base#renameMailbox()

Prepares an IMAP search query. Needed because certain configuration parameters may need to be dynamically altered before passed to the Imap_Client object.

protected _search(string $mailbox[, Horde_Imap_Client_Search_Query $query = null ][, array<string|int, mixed> $opts = array() ]) : array<string|int, mixed>
Parameters
$mailbox : string

The mailbox to search.

$query : Horde_Imap_Client_Search_Query = null

The search query object.

$opts : array<string|int, mixed> = array()

Additional options.

Return values
array<string|int, mixed>

Parameters to use in the search() call.

_status()

Handle status() calls. This call may hit multiple servers.

protected _status(mixed $args) : mixed
Parameters
$args : mixed
Tags
see

Horde_Imap_Client_Base#status()


        
On this page

Search results