Zend Framework  1.12
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Zend_Mail_Storage_Mbox Class Reference

Public Member Functions

 countMessages ()
 Count messages all messages in current box.
 
 getSize ($id=0)
 Get a list of messages with number and size.
 
 getMessage ($id)
 Fetch a message.
 
 getRawHeader ($id, $part=null, $topLines=0)
 
 getRawContent ($id, $part=null)
 
 __construct ($params)
 Create instance with parameters Supported parameters are:
 
 close ()
 Close resource for mail lib.
 
 noop ()
 Waste some CPU cycles doing nothing.
 
 removeMessage ($id)
 stub for not supported message deletion
 
 getUniqueId ($id=null)
 get unique id for one or all messages
 
 getNumberByUniqueId ($id)
 get a message number from a unique id
 
 __sleep ()
 magic method for serialize()
 
 __wakeup ()
 magic method for unserialize()
 
- Public Member Functions inherited from Zend_Mail_Storage_Abstract
 __get ($var)
 Getter for has-properties.
 
 getCapabilities ()
 Get a full list of features supported by the specific mail lib and the server.
 
 countMessages ()
 Count messages messages in current box/folder.
 
 getSize ($id=0)
 Get a list of messages with number and size.
 
 getMessage ($id)
 Get a message with headers and body.
 
 getRawHeader ($id, $part=null, $topLines=0)
 Get raw header of message or part.
 
 getRawContent ($id, $part=null)
 Get raw content of message or part.
 
 __construct ($params)
 Create instance with parameters.
 
 __destruct ()
 Destructor calls close() and therefore closes the resource.
 
 close ()
 Close resource for mail lib.
 
 noop ()
 Keep the resource alive.
 
 removeMessage ($id)
 delete a message from current box/folder
 
 getUniqueId ($id=null)
 get unique id for one or all messages
 
 getNumberByUniqueId ($id)
 get a message number from a unique id
 
 count ()
 Countable::count()
 
 offsetExists ($id)
 ArrayAccess::offsetExists()
 
 offsetGet ($id)
 ArrayAccess::offsetGet()
 
 offsetSet ($id, $value)
 ArrayAccess::offsetSet()
 
 offsetUnset ($id)
 ArrayAccess::offsetUnset()
 
 rewind ()
 Iterator::rewind()
 
 current ()
 Iterator::current()
 
 key ()
 Iterator::key()
 
 next ()
 Iterator::next()
 
 valid ()
 Iterator::valid()
 
 seek ($pos)
 SeekableIterator::seek()
 

Protected Member Functions

 _getPos ($id)
 Get positions for mail message or throw exeption if id is invalid.
 
 _isMboxFile ($file, $fileIsString=true)
 check if given file is a mbox file
 
 _openMboxFile ($filename)
 open given file as current mbox file
 

Protected Attributes

 $_fh
 
 $_filename
 
 $_filemtime
 
 $_positions
 
 $_messageClass = 'Zend_Mail_Message_File'
 
- Protected Attributes inherited from Zend_Mail_Storage_Abstract
 $_has
 
 $_iterationPos = 0
 
 $_iterationMax = null
 
 $_messageClass = 'Zend_Mail_Message'
 

Constructor & Destructor Documentation

__construct (   $params)

Create instance with parameters Supported parameters are:

  • filename filename of mbox file
Parameters
array$paramsmail reader specific parameters
Exceptions
Zend_Mail_Storage_Exception
See Also
Zend_Mail_Storage_Exception

Member Function Documentation

__sleep ( )

magic method for serialize()

with this method you can cache the mbox class

Returns
array name of variables
__wakeup ( )

magic method for unserialize()

with this method you can cache the mbox class for cache validation the mtime of the mbox file is used

Returns
null
Exceptions
Zend_Mail_Storage_Exception
See Also
Zend_Mail_Storage_Exception
_getPos (   $id)
protected

Get positions for mail message or throw exeption if id is invalid.

Parameters
int$idnumber of message
Returns
array positions as in _positions
Exceptions
Zend_Mail_Storage_Exception
See Also
Zend_Mail_Storage_Exception
_isMboxFile (   $file,
  $fileIsString = true 
)
protected

check if given file is a mbox file

if $file is a resource its file pointer is moved after the first line

Parameters
resource | string$filestream resource of name of file
bool$fileIsStringfile is string or resource
Returns
bool file is mbox file
_openMboxFile (   $filename)
protected

open given file as current mbox file

Parameters
string$filenamefilename of mbox file
Returns
null
Exceptions
Zend_Mail_Storage_Exception
See Also
Zend_Mail_Storage_Exception
Zend_Mail_Storage_Exception
close ( )

Close resource for mail lib.

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

Returns
void
countMessages ( )

Count messages all messages in current box.

Returns
int number of messages
Exceptions
Zend_Mail_Storage_Exception
getMessage (   $id)

Fetch a message.

Parameters
int$idnumber of message
Returns
Zend_Mail_Message_File
Exceptions
Zend_Mail_Storage_Exception
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
getRawContent (   $id,
  $part = null 
)
getRawHeader (   $id,
  $part = null,
  $topLines = 0 
)
getSize (   $id = 0)

Get a list of messages with number and size.

Parameters
int | null$idnumber of message or null for all messages
Returns
int|array size of given message of list with all messages as array(num => size)
getUniqueId (   $id = null)

get unique id for one or all messages

Mbox does not support unique ids (yet) - it's always the same as the message number. That shouldn't be a problem, because we can't change mbox files. Therefor the message number is save enough.

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

Waste some CPU cycles doing nothing.

Returns
void
removeMessage (   $id)

stub for not supported message deletion

Returns
null
Exceptions
Zend_Mail_Storage_Exception
See Also
Zend_Mail_Storage_Exception

Member Data Documentation

$_fh
protected
$_filemtime
protected
$_filename
protected
$_messageClass = 'Zend_Mail_Message_File'
protected
$_positions
protected