package Default
inherited_from \Zend\Mail\Storage\Folder\Maildir

 Methods

Create instance with parameters Additional parameters are (see parent for more): - create if true a new maildir is create if none exists

__construct(array $params) 
inherited_from \Zend\Mail\Storage\Folder\Maildir::__construct()

Parameters

$params

array mail reader specific parameters

Exceptions

\Zend\Mail\Storage\Exception\ExceptionInterface

Create instance with parameters

__construct(array $params) 
Inherited

Parameters

$params

array

mail reader specific parameters

Exceptions

\Zend\Mail\Storage\Exception\ExceptionInterface

Destructor calls close() and therefore closes the resource.

__destruct() 
Inherited

Getter for has-properties. The standard has properties are: hasFolder, hasUniqueid, hasDelete, hasCreate, hasTop

__get(string $var) : boolean
Inherited

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

Parameters

$var

string

property name

Exceptions

\Zend\Mail\Storage\Exception\InvalidArgumentException

Returns

booleansupported or not

append a new message to mail storage

appendMessage(string|\Zend\Mail\Message|\Zend\Mime\Message $message, null|string|\Zend\Mail\Storage\Folder $folder = null, null|array $flags = null, $recent = false
inherited_from \Zend\Mail\Storage\Writable\WritableInterface::appendMessage()

Parameters

$message

$folder

$flags

$recent

check if storage is currently over quota

checkQuota(boolean $detailedResponse = false, boolean $forceRecalc = false) : boolean | array
see

Parameters

$detailedResponse

boolean

return known data of quota and current size and message count

$forceRecalc

boolean

Returns

booleanarrayover quota state or detailed response

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

close() 
Inherited

copy an existing message

copyMessage(integer $id, string|\Zend\Mail\Storage\Folder $folder) 
inherited_from \Zend\Mail\Storage\Writable\WritableInterface::copyMessage()

Parameters

$id

integer

number of message

$folder

string\Zend\Mail\Storage\Folder

name or instance of targer folder

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

Countable::count()

count() : integer
Inherited

Returns

integer

Count messages messages in current box/folder

countMessages() : integer
Inherited

Exceptions

\Zend\Mail\Storage\Exception\ExceptionInterface

Returns

integernumber of messages

create a new folder

createFolder(string $name, string|\Zend\Mail\Storage\Folder $parentFolder = null) : string

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

inherited_from \Zend\Mail\Storage\Writable\WritableInterface::createFolder()

Parameters

$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

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

Returns

stringonly used internally (new created maildir)

Iterator::current()

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

Returns

\Zend\Mail\Storage\Messagecurrent message

Get a full list of features supported by the specific mail lib and the server

getCapabilities() : array
Inherited

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
Inherited
inherited_from \Zend\Mail\Storage\Folder\FolderInterface::getCurrentFolder()

Returns

\Zend\Mail\Storage\Folderinstance of current folder

get root folder or given folder

getFolders(string $rootFolder = null) : \Zend\Mail\Storage\Folder
Inherited
inherited_from \Zend\Mail\Storage\Folder\FolderInterface::getFolders()

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

Get a message with headers and body

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

Parameters

$id

int number of message

Returns

\Zend\Mail\Storage\Message

get a message number from a unique id

getNumberByUniqueId(string $id) : integer
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()

Parameters

$id

string

unique id

Exceptions

\Zend\Mail\Storage\Exception\ExceptionInterface

Returns

integermessage number

get currently set quota

getQuota(boolean $fromStorage = false) : boolean | array
see

Parameters

$fromStorage

boolean

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

Returns

booleanarray

Get raw content of message or part

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

Parameters

$id

integer

number of message

$part

nullarraystring

path to part or null for message content

Returns

stringraw content

Get raw header of message or part

getRawHeader(integer $id, null|array|string $part = null, integer $topLines = 0) : string
Inherited

Parameters

$id

integer

number of message

$part

nullarraystring

path to part or null for message header

$topLines

integer

include this many lines with header (after an empty line)

Returns

stringraw header

Get a list of messages with number and size

getSize(integer $id = 0) : integer | array
Inherited

Parameters

$id

integer

number of message

Returns

integerarraysize of given message of list with all messages as array(num => size)

get unique id for one or all messages

getUniqueId(integer|null $id = null) : array | string
Inherited

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

Parameters

$id

integernull

message number

Exceptions

\Zend\Mail\Storage\Exception\ExceptionInterface

Returns

arraystringmessage number for given message or all messages as array

create a new maildir

initMaildir(string $dir) 
Static

If the given dir is already a valid maildir this will not fail.

Parameters

$dir

string

directory for the new maildir (may already exist)

Exceptions

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

Iterator::key()

key() : integer
Inherited

Returns

integerid of current position

move an existing message

moveMessage(integer $id, string|\Zend\Mail\Storage\Folder $folder) 
inherited_from \Zend\Mail\Storage\Writable\WritableInterface::moveMessage()

Parameters

$id

integer

number of message

$folder

string\Zend\Mail\Storage\Folder

name or instance of targer folder

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

Iterator::next()

next() 
Inherited

Keep the resource alive.

noop() 
Inherited

ArrayAccess::offsetExists()

offsetExists(integer $id) : boolean
Inherited

Parameters

$id

integer

Returns

boolean

ArrayAccess::offsetGet()

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

Parameters

$id

integer

Returns

\Zend\Mail\Storage\Messagemessage object

ArrayAccess::offsetSet()

offsetSet(mixed $id, mixed $value) 
Inherited

Parameters

$id

mixed

$value

mixed

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

ArrayAccess::offsetUnset()

offsetUnset(integer $id) : boolean
Inherited

Parameters

$id

integer

Returns

booleansuccess

remove a folder

removeFolder(string|\Zend\Mail\Storage\Folder $name) 
inherited_from \Zend\Mail\Storage\Writable\WritableInterface::removeFolder()

Parameters

$name

string\Zend\Mail\Storage\Folder

name or instance of folder

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

stub for not supported message deletion

removeMessage($id) 

Parameters

$id

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

delete a message from current box/folder

removeMessage($id) 
Inherited

Parameters

$id

rename and/or move folder

renameFolder(string|\Zend\Mail\Storage\Folder $oldName, string $newName) 

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

inherited_from \Zend\Mail\Storage\Writable\WritableInterface::renameFolder()

Parameters

$oldName

string\Zend\Mail\Storage\Folder

name or instance of folder

$newName

string

new global name of folder

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.

SeekableIterator::seek()

seek(integer $pos) 
Inherited

Parameters

$pos

integer

Exceptions

\Zend\Mail\Storage\Exception\OutOfBoundsException

select given folder

selectFolder(\Zend\Mail\Storage\Folder|string $globalName) 
Inherited

folder must be selectable!

inherited_from \Zend\Mail\Storage\Folder\FolderInterface::selectFolder()

Parameters

$globalName

\Zend\Mail\Storage\Folderstring

global name of folder or instance for subfolder

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

set flags for message

setFlags(integer $id, array $flags) 

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

inherited_from \Zend\Mail\Storage\Writable\WritableInterface::setFlags()

Parameters

$id

integer

number of message

$flags

array

new flags for message

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

enable/disable quota and set a quota value if wanted or needed

setQuota(boolean|array $value) 

You can enable/disable quota with true/false. If you don't have a MDA or want to enforce a quota value you can also set this value here. Use array('size' => SIZE_QUOTA, 'count' => MAX_MESSAGE) do define your quota. Order of these fields does matter!

Parameters

$value

booleanarray

new quota value

Iterator::valid()

valid() : boolean
Inherited

Returns

boolean

_addQuotaEntry()

_addQuotaEntry($size, $count = 1

Parameters

$size

$count

find all subfolders and mbox files for folder structure

_buildFolderTree() 
Inherited

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

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

_calculateMaildirsize()

_calculateMaildirsize() : array
see "Calculating maildirsize"

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

Returns

array

_calculateQuota()

_calculateQuota(boolean $forceRecalc = false) : array
see "Calculating the quota for a Maildir++"

Parameters

$forceRecalc

boolean

Returns

array

open a temporary maildir file

_createTmpFile(string $folder = 'INBOX') : array

makes sure tmp/ exists and create a file with a unique name you should close the returned filehandle!

Parameters

$folder

string

name of current folder without leading .

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

Returns

arrayarray('dirname' => dir of maildir folder, 'uniq' => unique id, 'filename' => name of create file 'handle' => file opened for writing)

create a uniqueid for maildir filename

_createUniqueId() : string

This is nearly the format defined in the maildir standard. The microtime() call should already create a uniqueid, the pid is for multicore/-cpu machine that manage to call this function at the exact same time, and uname() gives us the hostname for multiple machines accessing the same storage.

If someone disables posix we create a random number of the same size, so this method should also work on Windows - if you manage to get maildir working on Windows. Microtime could also be disabled, although I've never seen it.

Returns

stringnew uniqueid

Get one or all fields from file structure. Also checks if message is valid

_getFileData(integer $id, string|null $field = null) : string | array
Inherited

Parameters

$id

integer

message number

$field

stringnull

wanted field

Exceptions

\Zend\Mail\Storage\Exception\InvalidArgumentException

Returns

stringarraywanted field or all fields as array

create an info string for filenames with given flags

_getInfoString(array $flags) : string

Parameters

$flags

array

wanted flags, with the reference you'll get the set flags with correct key (= char for flag)

Exceptions

\Zend\Mail\Storage\Exception\InvalidArgumentException

Returns

stringinfo string for version 2 filenames including the leading colon

find all files in opened dir handle and add to maildir files

_getMaildirFiles(resource $dh, string $dirname, array $defaultFlags = array()
Inherited

Parameters

$dh

resource

dir handle used for search

$dirname

string

dirname of dir in $dh

$defaultFlags

array

default flags for given dir

check if a given dir is a valid maildir

_isMaildir(string $dirname) : boolean
Inherited

Parameters

$dirname

string

name of dir

Returns

booleandir is valid maildir

open given dir as current maildir

_openMaildir(string $dirname) 
Inherited

Parameters

$dirname

string

name of maildir

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

 Properties

 

name of current folder

$currentFolder : string

Default

 

delim char for subfolders

$delim : string

Default

 

data of found message files in maildir dir

$files : array

Default

array()
 

class capabilities with default values

$has : array

Default

array('uniqueid' => true, 'delete' => false, 'create' => false, 'top' => false, 'fetchPart' => true, 'flags' => false)
 

maximum iteration position (= message count)

$iterationMax : null | integer

Default

null
 

current iteration position

$iterationPos : integer

Default

0
 

known flag chars in filenames

$knownFlags : array

Default

array('D' => \Zend\Mail\Storage::FLAG_DRAFT, 'F' => \Zend\Mail\Storage::FLAG_FLAGGED, 'P' => \Zend\Mail\Storage::FLAG_PASSED, 'R' => \Zend\Mail\Storage::FLAG_ANSWERED, 'S' => \Zend\Mail\Storage::FLAG_SEEN, 'T' => \Zend\Mail\Storage::FLAG_DELETED)
Static

This list has to be in alphabetical order for setFlags()

 

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

$messageClass : string

Default

'Zend\Mail\Storage\Message'
 

use quota and size of quota if given

$quota : boolean | integer

Default

 

root folder for folder structure

$rootFolder : \Zend\Mail\Storage\Folder

Default

 

rootdir of folder structure

$rootdir : string

Default