Mail/Storage/Imap.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Mail
- Subpackage
- Storage
- Version
- $Id$
\Zend_Mail_Storage_Imap
Package: Zend_Mail\Storage- Implements
- Parent(s)
- \Zend_Mail_Storage_Abstract
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties



array $_knownFlags = array('\Passed' => \Zend_Mail_Storage::FLAG_PASSED, '\Answered' => \Zend_Mail_Storage::FLAG_ANSWERED, '\Seen' => \Zend_Mail_Storage::FLAG_SEEN, '\Deleted' => \Zend_Mail_Storage::FLAG_DELETED, '\Draft' => \Zend_Mail_Storage::FLAG_DRAFT, '\Flagged' => \Zend_Mail_Storage::FLAG_FLAGGED)
staticimap flags to constants translation
Default valuearray('\Passed' => \Zend_Mail_Storage::FLAG_PASSED, '\Answered' => \Zend_Mail_Storage::FLAG_ANSWERED, '\Seen' => \Zend_Mail_Storage::FLAG_SEEN, '\Deleted' => \Zend_Mail_Storage::FLAG_DELETED, '\Draft' => \Zend_Mail_Storage::FLAG_DRAFT, '\Flagged' => \Zend_Mail_Storage::FLAG_FLAGGED)
Details- Type
- array



array $_searchFlags = array('\Recent' => 'RECENT', '\Answered' => 'ANSWERED', '\Seen' => 'SEEN', '\Deleted' => 'DELETED', '\Draft' => 'DRAFT', '\Flagged' => 'FLAGGED')
staticmap flags to search criterias
Default valuearray('\Recent' => 'RECENT', '\Answered' => 'ANSWERED', '\Seen' => 'SEEN', '\Deleted' => 'DELETED', '\Draft' => 'DRAFT', '\Flagged' => 'FLAGGED')
Details- Type
- array
Methods



__construct(array $params) : void
create instance with parameters
Supported paramters 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']
ParametersName | Type | Description |
---|
$params | array | mail reader specific parameters |
---|
Throws 


countMessages( $flags = null) : int
Count messages all messages in current box
ParametersName | Type | Description |
---|
$flags | | |
---|
ReturnsType | Description |
---|
int | number of messages |
Throws 


createFolder(string $name, string | \Zend_Mail_Storage_Folder $parentFolder = null) : null
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
ParametersName | Type | Description |
---|
$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 |
---|
ReturnsThrows


getFolders(string $rootFolder = null) : \Zend_Mail_Storage_Folder
get root folder or given folder
ParametersName | Type | Description |
---|
$rootFolder | string | get folder structure for given folder, else root |
---|
ReturnsThrows 


getMessage(int $id) : \Zend_Mail_Message
ParametersName | Type | Description |
---|
$id | int | number of message |
---|
ReturnsThrows 


getNumberByUniqueId(string $id) : int
get a message number from a unique id
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()
ParametersName | Type | Description |
---|
$id | string | unique id |
---|
ReturnsType | Description |
---|
int | message number |
Throws


getSize(int $id = 0) : int | array
get a list of messages with number and size
ParametersName | Type | Description |
---|
$id | int | number of message |
---|
ReturnsType | Description |
---|
int | array | size of given message of list with all messages as array(num => size) |
Throws 


getUniqueId(int | null $id = null) : array | string
get unique id for one or all messages
if storage does not support unique ids it's the same as the message number
ParametersName | Type | Description |
---|
$id | int | null | message number |
---|
ReturnsType | Description |
---|
array | string | message number for given message or all messages as array |
Throws


removeMessage(int $id) : null
Remove a message from server. If you're doing that from a web enviroment
you should be careful and use a uniqueid as parameter if possible to
identify the message.
ParametersName | Type | Description |
---|
$id | int | number of message |
---|
ReturnsThrows 


renameFolder(string | \Zend_Mail_Storage_Folder $oldName, string $newName) : null
rename and/or move folder
The new name has the same restrictions as in createFolder()
ParametersName | Type | Description |
---|
$oldName | string | \Zend_Mail_Storage_Folder | name or instance of folder |
---|
$newName | string | new global name of folder |
---|
ReturnsThrows


setFlags(int $id, array $flags) : void
NOTE: this method can't set the recent flag.
ParametersName | Type | Description |
---|
$id | int | number of message |
---|
$flags | array | new flags for message |
---|
Throws