Methods

create instance with parameters Supported parameters are - user username - host hostname or ip address of IMAP server [optional, default = 'localhost'] - password password for user 'username' [optional, default = ''] - port port for IMAP server [optional, default = 110] - ssl 'SSL' or 'TLS' for secure sockets - folder select this folder [optional, default = 'INBOX']

__construct(array $params) 

Destructor calls close() and therefore closes the resource.

__destruct() 
Inherited

inherited_from \Zend\Mail\Storage\AbstractStorage::__destruct()

Getter for has-properties.

__get(string $var) : bool
Inherited

The standard has properties are: hasFolder, hasUniqueid, hasDelete, hasCreate, hasTop

The valid values for the has-properties are: - true if a feature is supported - false if a feature is not supported - null is it's not yet known or it can't be know if a feature is supported

inherited_from \Zend\Mail\Storage\AbstractStorage::__get()

Parameters

$var

string

property name

Exceptions

\Zend\Mail\Storage\Exception\InvalidArgumentException

Returns

boolsupported or not

append a new message to mail storage

appendMessage(string | \Zend\Mail\Message | \Zend\Mime\Message $message, null | string | \Zend\Mail\Storage\Folder $folder, null | array $flags) 

Parameters

$message

string\Zend\Mail\Message\Zend\Mime\Message

message as string or instance of message class

$folder

nullstring\Zend\Mail\Storage\Folder

folder for new message, else current folder is taken

$flags

nullarray

set flags for new message, else a default set is used

Exceptions

\Zend\Mail\Storage\Exception\ExceptionInterface

Close resource for mail lib.

close() 

If you need to control, when the resource is closed. Otherwise the destructor would call this.

copy an existing message

copyMessage(int $id, string | \Zend\Mail\Storage\Folder $folder) 

Parameters

$id

int

number of message

$folder

string\Zend\Mail\Storage\Folder

name or instance of target folder

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

Countable::count()

count() : int
Inherited

inherited_from \Zend\Mail\Storage\AbstractStorage::count()

Returns

int

Count messages all messages in current box

countMessages(null $flags) : int

Parameters

$flags

null

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException
\Zend\Mail\Protocol\Exception\RuntimeException

Returns

intnumber of messages

create a new folder

createFolder(string $name, string | \Zend\Mail\Storage\Folder $parentFolder) 

This method also creates parent folders if necessary. Some mail storages may restrict, which folder may be used as parent or which chars may be used in the folder name

Parameters

$name

string

global name of folder, local name if $parentFolder is set

$parentFolder

string\Zend\Mail\Storage\Folder

parent folder for new folder, else root folder is parent

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

Iterator::current()

current() : \Zend\Mail\Storage\Message
Inherited

inherited_from \Zend\Mail\Storage\AbstractStorage::current()

Returns

Get a full list of features supported by the specific mail lib and the server

getCapabilities() : array
Inherited

inherited_from \Zend\Mail\Storage\AbstractStorage::getCapabilities()

Returns

arraylist of features as array(feature_name => true|false[|null])

get \Zend\Mail\Storage\Folder instance for current folder

getCurrentFolder() : \Zend\Mail\Storage\Folder

Exceptions

\Zend\Mail\Storage\Exception\ExceptionInterface

Returns

\Zend\Mail\Storage\Folderinstance of current folder

get root folder or given folder

getFolders(string $rootFolder) : \Zend\Mail\Storage\Folder

Parameters

$rootFolder

string

get folder structure for given folder, else root

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException
\Zend\Mail\Storage\Exception\InvalidArgumentException
\Zend\Mail\Protocol\Exception\RuntimeException

Returns

\Zend\Mail\Storage\Folderroot or wanted folder

Fetch a message

getMessage(int $id) : \Zend\Mail\Storage\Message

Parameters

$id

int

number of message

Exceptions

\Zend\Mail\Protocol\Exception\RuntimeException

Returns

get a message number from a unique id

getNumberByUniqueId(string $id) : int

I.e. if you have a webmailer that supports deleting messages you should use unique ids as parameter and use this method to translate it to message number right before calling removeMessage()

Parameters

$id

string

unique id

Exceptions

\Zend\Mail\Storage\Exception\InvalidArgumentException

Returns

intmessage number

Get raw content of message or part

getRawContent(int $id, null | array | string $part) : string

Parameters

$id

int

number of message

$part

nullarraystring

path to part or null for message content

Returns

stringraw content

Get raw header of message or part

getRawHeader(int $id, null | array | string $part, int $topLines) : string

Parameters

$id

int

number of message

$part

nullarraystring

path to part or null for message header

$topLines

int

include this many lines with header (after an empty line)

Returns

stringraw header

get a list of messages with number and size

getSize(int $id) : int | array

Parameters

$id

int

number of message

Exceptions

\Zend\Mail\Protocol\Exception\RuntimeException

Returns

intarraysize of given message of list with all messages as array(num => size)

get unique id for one or all messages

getUniqueId(int | null $id) : array | string

if storage does not support unique ids it's the same as the message number

Parameters

$id

intnull

message number

Exceptions

\Zend\Mail\Protocol\Exception\RuntimeException

Returns

arraystringmessage number for given message or all messages as array

Iterator::key()

key() : int
Inherited

inherited_from \Zend\Mail\Storage\AbstractStorage::key()

Returns

intid of current position

move an existing message

moveMessage(int $id, string | \Zend\Mail\Storage\Folder $folder) 

NOTE: IMAP has no native move command, thus it's emulated with copy and delete

Parameters

$id

int

number of message

$folder

string\Zend\Mail\Storage\Folder

name or instance of target folder

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

Keep the server busy.

noop() 

ArrayAccess::offsetExists()

offsetExists(int $id) : boolean
Inherited

inherited_from \Zend\Mail\Storage\AbstractStorage::offsetExists()

Parameters

$id

int

Returns

boolean

ArrayAccess::offsetGet()

offsetGet(int $id) : \Zend\Mail\Storage\Message
Inherited

inherited_from \Zend\Mail\Storage\AbstractStorage::offsetGet()

Parameters

$id

int

Returns

ArrayAccess::offsetSet()

offsetSet(mixed $id, mixed $value) 
Inherited

inherited_from \Zend\Mail\Storage\AbstractStorage::offsetSet()

Parameters

$id

mixed

$value

mixed

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

ArrayAccess::offsetUnset()

offsetUnset(int $id) : boolean
Inherited

inherited_from \Zend\Mail\Storage\AbstractStorage::offsetUnset()

Parameters

$id

int

Returns

booleansuccess

remove a folder

removeFolder(string | \Zend\Mail\Storage\Folder $name) 

Parameters

$name

string\Zend\Mail\Storage\Folder

name or instance of folder

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

Remove a message from server.

removeMessage(int $id) 

If you're doing that from a web environment you should be careful and use a uniqueid as parameter if possible to identify the message.

Parameters

$id

int

number of message

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

rename and/or move folder

renameFolder(string | \Zend\Mail\Storage\Folder $oldName, string $newName) 

The new name has the same restrictions as in createFolder()

Parameters

$oldName

string\Zend\Mail\Storage\Folder

name or instance of folder

$newName

string

new global name of folder

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

Iterator::rewind()

rewind() 
Inherited

Rewind always gets the new count from the storage. Thus if you use the interfaces and your scripts take long you should use reset() from time to time.

inherited_from \Zend\Mail\Storage\AbstractStorage::rewind()

SeekableIterator::seek()

seek(int $pos) 
Inherited

inherited_from \Zend\Mail\Storage\AbstractStorage::seek()

Parameters

$pos

int

Exceptions

\Zend\Mail\Storage\Exception\OutOfBoundsException

select given folder

selectFolder(\Zend\Mail\Storage\Folder | string $globalName) 

folder must be selectable!

Parameters

$globalName

\Zend\Mail\Storage\Folderstring

global name of folder or instance for subfolder

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException
\Zend\Mail\Protocol\Exception\RuntimeException

set flags for message

setFlags(int $id, array $flags) 

NOTE: this method can't set the recent flag.

Parameters

$id

int

number of message

$flags

array

new flags for message

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

Iterator::valid()

valid() : bool
Inherited

inherited_from \Zend\Mail\Storage\AbstractStorage::valid()

Returns

bool

 Properties

 

name of current folder

$currentFolder : string

 

class capabilities with default values

$has : array
Inherited

inherited_from \Zend\Mail\Storage\AbstractStorage::$$has
 

maximum iteration position (= message count)

$iterationMax : null | int
Inherited

inherited_from \Zend\Mail\Storage\AbstractStorage::$$iterationMax
 

current iteration position

$iterationPos : int
Inherited

inherited_from \Zend\Mail\Storage\AbstractStorage::$$iterationPos
 

IMAP flags to constants translation

$knownFlags : array

 

used message class, change it in an extended class to extend the returned message class

$messageClass : string
Inherited

inherited_from \Zend\Mail\Storage\AbstractStorage::$$messageClass
 

protocol handler

$protocol : null | \Zend\Mail\Protocol\Imap

 

IMAP flags to search criteria

$searchFlags : array