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) : voidcreate 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']
Parameters| Name | Type | Description |
|---|
| $params | array | mail reader specific parameters |
|---|
Throws 


countMessages( $flags = null) : intCount messages all messages in current box
Parameters| Name | Type | Description |
|---|
| $flags | | |
|---|
Returns| Type | Description |
|---|
| int | number of messages |
Throws 


createFolder(string $name, string | \Zend_Mail_Storage_Folder $parentFolder = null) : nullThis 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 | 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_Folderget root folder or given folder
Parameters| Name | Type | Description |
|---|
| $rootFolder | string | get folder structure for given folder, else root |
|---|
ReturnsThrows 


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


getNumberByUniqueId(string $id) : intget 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()
Parameters| Name | Type | Description |
|---|
| $id | string | unique id |
|---|
Returns| Type | Description |
|---|
| int | message number |
Throws


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


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


removeMessage(int $id) : nullRemove 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.
Parameters| Name | Type | Description |
|---|
| $id | int | number of message |
|---|
ReturnsThrows 


renameFolder(string | \Zend_Mail_Storage_Folder $oldName, string $newName) : nullrename and/or move folder
The new name has the same restrictions as in createFolder()
Parameters| Name | 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) : voidNOTE: this method can't set the recent flag.
Parameters| Name | Type | Description |
|---|
| $id | int | number of message |
|---|
| $flags | array | new flags for message |
|---|
Throws