category Zend
package Zend_Mail
subpackage Storage

 Methods

Create instance with parameters

__construct(\Zend\Mail\Storage\Folder\$params $params) 

Disallowed parameters are: - filename use \Zend\Mail\Storage\Mbox for a single file Supported parameters are: - dirname rootdir of mbox structure - folder intial selected folder, default is 'INBOX'

Parameters

$params

\Zend\Mail\Storage\Folder\$params

array mail reader specific parameters

Exceptions

\Zend\Mail\Storage\Exception\InvalidArgumentException

Destructor calls close() and therefore closes the resource.

__destruct() 
Inherited

inherited_from \Zend\Mail\Storage\AbstractStorage::__destruct()
inherited_from \Zend\Mail\Storage\Mbox::__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()
inherited_from \Zend\Mail\Storage\Mbox::__get()

Parameters

$var

string

property name

Exceptions

\Zend\Mail\Storage\Exception\InvalidArgumentException

Returns

boolsupported or not

magic method for serialize()

__sleep() : array

with this method you can cache the mbox class

Returns

arrayname of variables

magic method for unserialize(), with this method you can cache the mbox class

__wakeup() 

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

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

Close resource for mail lib.

close() 
Inherited

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

inherited_from \Zend\Mail\Storage\Mbox::close()

Countable::count()

count() : int
Inherited

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

Returns

int

Count messages all messages in current box

countMessages() : int
Inherited

inherited_from \Zend\Mail\Storage\Mbox::countMessages()

Exceptions

\Zend\Mail\Storage\Exception\ExceptionInterface

Returns

intnumber of messages

Iterator::current()

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

inherited_from \Zend\Mail\Storage\AbstractStorage::current()
inherited_from \Zend\Mail\Storage\Mbox::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()
inherited_from \Zend\Mail\Storage\Mbox::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\InvalidArgumentException

Returns

\Zend\Mail\Storage\Folderroot or wanted folder

Fetch a message

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

inherited_from \Zend\Mail\Storage\Mbox::getMessage()

Parameters

$id

int

number of message

Exceptions

\Zend\Mail\Storage\Exception\ExceptionInterface

Returns

get a message number from a unique id

getNumberByUniqueId(string $id) : int
Inherited

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

inherited_from \Zend\Mail\Storage\Mbox::getNumberByUniqueId()

Parameters

$id

string

unique id

Exceptions

\Zend\Mail\Storage\Exception\ExceptionInterface

Returns

intmessage number

Get raw content of message or part

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

inherited_from \Zend\Mail\Storage\Mbox::getRawContent()

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
Inherited

inherited_from \Zend\Mail\Storage\Mbox::getRawHeader()

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 | null $id) : int | array
Inherited

inherited_from \Zend\Mail\Storage\Mbox::getSize()

Parameters

$id

intnull

number of message or null for all messages

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
Inherited

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.

inherited_from \Zend\Mail\Storage\Mbox::getUniqueId()

Parameters

$id

intnull

message number

Exceptions

\Zend\Mail\Storage\Exception\ExceptionInterface

Returns

arraystringmessage number for given message or all messages as array

Iterator::key()

key() : int
Inherited

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

Returns

intid of current position

Waste some CPU cycles doing nothing.

noop() : bool
Inherited

inherited_from \Zend\Mail\Storage\Mbox::noop()

Returns

boolalways return true

ArrayAccess::offsetExists()

offsetExists(int $id) : boolean
Inherited

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

Parameters

$id

int

Returns

boolean

ArrayAccess::offsetGet()

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

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

Parameters

$id

int

Returns

ArrayAccess::offsetSet()

offsetSet(mixed $id, mixed $value) 
Inherited

inherited_from \Zend\Mail\Storage\AbstractStorage::offsetSet()
inherited_from \Zend\Mail\Storage\Mbox::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()
inherited_from \Zend\Mail\Storage\Mbox::offsetUnset()

Parameters

$id

int

Returns

booleansuccess

stub for not supported message deletion

removeMessage($id) 
Inherited

inherited_from \Zend\Mail\Storage\Mbox::removeMessage()

Parameters

$id

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()
inherited_from \Zend\Mail\Storage\Mbox::rewind()

SeekableIterator::seek()

seek(int $pos) 
Inherited

inherited_from \Zend\Mail\Storage\AbstractStorage::seek()
inherited_from \Zend\Mail\Storage\Mbox::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

Iterator::valid()

valid() : bool
Inherited

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

Returns

bool

find all subfolders and mbox files for folder structure

_buildFolderTree(string $currentDir, \Zend\Mail\Storage\Folder | null $parentFolder, string $parentGlobalName) 

Result is save in \Zend\Mail\Storage\Folder instances with the root in $this->rootFolder. $parentFolder and $parentGlobalName are only used internally for recursion.

Parameters

$currentDir

string

call with root dir, also used for recursion.

$parentFolder

\Zend\Mail\Storage\Foldernull

used for recursion

$parentGlobalName

string

used for recursion

Exceptions

\Zend\Mail\Storage\Exception\InvalidArgumentException

Get positions for mail message or throw exception if id is invalid

getPos(int $id) : array
Inherited

inherited_from \Zend\Mail\Storage\Mbox::getPos()

Parameters

$id

int

number of message

Exceptions

\Zend\Mail\Storage\Exception\InvalidArgumentException

Returns

arraypositions as in positions

check if given file is a mbox file

isMboxFile(resource | string $file, bool $fileIsString) : bool
Inherited

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

inherited_from \Zend\Mail\Storage\Mbox::isMboxFile()

Parameters

$file

resourcestring

stream resource of name of file

$fileIsString

bool

file is string or resource

Returns

boolfile is mbox file

open given file as current mbox file

openMboxFile(string $filename) 
Inherited

inherited_from \Zend\Mail\Storage\Mbox::openMboxFile()

Parameters

$filename

string

filename of mbox file

Exceptions

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

 Properties

 

name of current folder

$currentFolder : string

 

file handle to mbox file

$fh : null | resource
Inherited

inherited_from \Zend\Mail\Storage\Mbox::$$fh
 

modification date of mbox file for __wakeup

$filemtime : int
Inherited

inherited_from \Zend\Mail\Storage\Mbox::$$filemtime
 

filename of mbox file for __wakeup

$filename : string
Inherited

inherited_from \Zend\Mail\Storage\Mbox::$$filename
 

class capabilities with default values

$has : array
Inherited

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

maximum iteration position (= message count)

$iterationMax : null | int
Inherited

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

current iteration position

$iterationPos : int
Inherited

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

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

$messageClass : string
Inherited

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

start and end position of messages as array('start' => start, 'separator' => headersep, 'end' => end)

$positions : array
Inherited

inherited_from \Zend\Mail\Storage\Mbox::$$positions
 

\Zend\Mail\Storage\Folder root folder for folder structure

$rootFolder : \Zend\Mail\Storage\Folder

 

rootdir of folder structure

$rootdir : string