Public Member Functions | Protected Attributes | Static Protected Attributes

Zend_Mail_Storage_Imap Class Reference

Inheritance diagram for Zend_Mail_Storage_Imap:
Zend_Mail_Storage_Abstract Zend_Mail_Storage_Folder_Interface Zend_Mail_Storage_Writable_Interface

Public Member Functions

 countMessages ($flags=null)
 getSize ($id=0)
 getMessage ($id)
 getRawHeader ($id, $part=null, $topLines=0)
 getRawContent ($id, $part=null)
 __construct ($params)
 close ()
 noop ()
 removeMessage ($id)
 getUniqueId ($id=null)
 getNumberByUniqueId ($id)
 getFolders ($rootFolder=null)
 selectFolder ($globalName)
 getCurrentFolder ()
 createFolder ($name, $parentFolder=null)
 removeFolder ($name)
 renameFolder ($oldName, $newName)
 appendMessage ($message, $folder=null, $flags=null)
 copyMessage ($id, $folder)
 moveMessage ($id, $folder)
 setFlags ($id, $flags)

Protected Attributes

 $_protocol
 $_currentFolder = ''

Static Protected Attributes

static $_knownFlags
static $_searchFlags

Detailed Description

Definition at line 66 of file Imap.php.


Constructor & Destructor Documentation

__construct ( params )

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']
Parameters:
array$paramsmail reader specific parameters
Exceptions:
Zend_Mail_Storage_Exception
Zend_Mail_Protocol_Exception

See also:
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception

Reimplemented from Zend_Mail_Storage_Abstract.

Definition at line 237 of file Imap.php.


Member Function Documentation

appendMessage ( message,
folder = null,
flags = null 
)

append a new message to mail storage

Parameters:
string$messagemessage as string or instance of message class
null | string | Zend_Mail_Storage_Folder$folderfolder for new message, else current folder is taken
null | array$flagsset flags for new message, else a default set is used
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception

Implements Zend_Mail_Storage_Writable_Interface.

Definition at line 570 of file Imap.php.

close (  )

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

Returns:
null

Reimplemented from Zend_Mail_Storage_Abstract.

Definition at line 290 of file Imap.php.

copyMessage ( id,
folder 
)

copy an existing message

Parameters:
int$idnumber of message
string | Zend_Mail_Storage_Folder$foldername or instance of targer folder
Returns:
null
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception

Implements Zend_Mail_Storage_Writable_Interface.

Definition at line 598 of file Imap.php.

countMessages ( flags = null )

Count messages all messages in current box

Returns:
int number of messages
Exceptions:
Zend_Mail_Storage_Exception
Zend_Mail_Protocol_Exception

See also:
Zend_Mail_Storage_Exception

Definition at line 113 of file Imap.php.

createFolder ( name,
parentFolder = null 
)

create a new folder

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:
string$nameglobal name of folder, local name if $parentFolder is set
string | Zend_Mail_Storage_Folder$parentFolderparent folder for new folder, else root folder is parent
Returns:
null
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception

Implements Zend_Mail_Storage_Writable_Interface.

Definition at line 494 of file Imap.php.

getCurrentFolder (  )

get Zend_Mail_Storage_Folder instance for current folder

Returns:
Zend_Mail_Storage_Folder instance of current folder
Exceptions:
Zend_Mail_Storage_Exception

Implements Zend_Mail_Storage_Folder_Interface.

Definition at line 478 of file Imap.php.

getFolders ( rootFolder = null )

get root folder or given folder

Parameters:
string$rootFolderget folder structure for given folder, else root
Returns:
Zend_Mail_Storage_Folder root or wanted folder
Exceptions:
Zend_Mail_Storage_Exception
Zend_Mail_Protocol_Exception

See also:
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception

Implements Zend_Mail_Storage_Folder_Interface.

Definition at line 395 of file Imap.php.

getMessage ( id )

Fetch a message

Parameters:
int$idnumber of message
Returns:
Zend_Mail_Message
Exceptions:
Zend_Mail_Protocol_Exception

Reimplemented from Zend_Mail_Storage_Abstract.

Definition at line 161 of file Imap.php.

getNumberByUniqueId ( id )

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()

Parameters:
string$idunique id
Returns:
int message number
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception

Reimplemented from Zend_Mail_Storage_Abstract.

Definition at line 369 of file Imap.php.

getRawContent ( id,
part = null 
)

Get raw content of message or part

Parameters:
int$idnumber of message
null | array | string$partpath to part or null for messsage content
Returns:
string raw content

See also:
Zend_Mail_Storage_Exception

Reimplemented from Zend_Mail_Storage_Abstract.

Definition at line 209 of file Imap.php.

getRawHeader ( id,
part = null,
topLines = 0 
)

Get raw header of message or part

Parameters:
int$idnumber of message
null | array | string$partpath to part or null for messsage header
int$topLinesinclude this many lines with header (after an empty line)
Returns:
string raw header

See also:
Zend_Mail_Storage_Exception

Reimplemented from Zend_Mail_Storage_Abstract.

Definition at line 185 of file Imap.php.

getSize ( id = 0 )

get a list of messages with number and size

Parameters:
int$idnumber of message
Returns:
int|array size of given message of list with all messages as array(num => size)
Exceptions:
Zend_Mail_Protocol_Exception

Reimplemented from Zend_Mail_Storage_Abstract.

Definition at line 146 of file Imap.php.

getUniqueId ( id = null )

get unique id for one or all messages

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

Parameters:
int | null$idmessage number
Returns:
array|string message number for given message or all messages as array
Exceptions:
Zend_Mail_Storage_Exception

Reimplemented from Zend_Mail_Storage_Abstract.

Definition at line 350 of file Imap.php.

moveMessage ( id,
folder 
)

move an existing message

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

Parameters:
int$idnumber of message
string | Zend_Mail_Storage_Folder$foldername or instance of targer folder
Returns:
null
Exceptions:
Zend_Mail_Storage_Exception

Implements Zend_Mail_Storage_Writable_Interface.

Definition at line 619 of file Imap.php.

noop (  )

Keep the server busy.

Returns:
null
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception

Reimplemented from Zend_Mail_Storage_Abstract.

Definition at line 302 of file Imap.php.

removeFolder ( name )

remove a folder

Parameters:
string | Zend_Mail_Storage_Folder$namename or instance of folder
Returns:
null
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception

Implements Zend_Mail_Storage_Writable_Interface.

Definition at line 521 of file Imap.php.

removeMessage ( id )

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.

Parameters:
int$idnumber of message
Returns:
null
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception

Reimplemented from Zend_Mail_Storage_Abstract.

Definition at line 322 of file Imap.php.

renameFolder ( oldName,
newName 
)

rename and/or move folder

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

Parameters:
string | Zend_Mail_Storage_Folder$oldNamename or instance of folder
string$newNamenew global name of folder
Returns:
null
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception

Implements Zend_Mail_Storage_Writable_Interface.

Definition at line 546 of file Imap.php.

selectFolder ( globalName )

select given folder

folder must be selectable!

Parameters:
Zend_Mail_Storage_Folder | string$globalNameglobal name of folder or instance for subfolder
Returns:
null
Exceptions:
Zend_Mail_Storage_Exception
Zend_Mail_Protocol_Exception

See also:
Zend_Mail_Storage_Exception

Implements Zend_Mail_Storage_Folder_Interface.

Definition at line 458 of file Imap.php.

setFlags ( id,
flags 
)

set flags for message

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

Parameters:
int$idnumber of message
array$flagsnew flags for message
Exceptions:
Zend_Mail_Storage_Exception

See also:
Zend_Mail_Storage_Exception

Implements Zend_Mail_Storage_Writable_Interface.

Definition at line 633 of file Imap.php.


Field Documentation

$_knownFlags [static, protected]
Initial value:
 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)

Definition at line 88 of file Imap.php.

$_searchFlags [static, protected]
Initial value:
 array('\Recent'   => 'RECENT',
                                           '\Answered' => 'ANSWERED',
                                           '\Seen'     => 'SEEN',
                                           '\Deleted'  => 'DELETED',
                                           '\Draft'    => 'DRAFT',
                                           '\Flagged'  => 'FLAGGED')

Definition at line 99 of file Imap.php.


The documentation for this class was generated from the following file: