2056. Class

2056.1. Zend\Mail\Storage\Writable\Maildir

2056.1.1. Methods

2056.1.1.1. initMaildir

initMaildir()

create a new maildir

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

Parameters:string – directory for the new maildir (may already exist)
Throws ZendMailStorageExceptionRuntimeException:
 
Throws ZendMailStorageExceptionInvalidArgumentException:
 

2056.1.1.2. __construct

__construct()

Create instance with parameters Additional parameters are (see parent for more):

  • create if true a new maildir is create if none exists
Parameters:$params – mail reader specific parameters
Throws ZendMailStorageExceptionExceptionInterface:
 

2056.1.1.3. createFolder

createFolder()

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 – global name of folder, local name if $parentFolder is set
  • string|ZendMailStorageFolder – parent folder for new folder, else root folder is parent
Throws ZendMailStorageExceptionRuntimeException:
 
Return type:

string only used internally (new created maildir)

2056.1.1.4. removeFolder

removeFolder()

remove a folder

Parameters:string|Folder – name or instance of folder
Throws ZendMailStorageExceptionRuntimeException:
 

2056.1.1.5. renameFolder

renameFolder()

rename and/or move folder

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

Parameters:
  • string|ZendMailStorageFolder – name or instance of folder
  • string – new global name of folder
Throws ZendMailStorageExceptionRuntimeException:
 

2056.1.1.6. _createUniqueId

_createUniqueId()

create a uniqueid for maildir filename

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.

Return type:string new uniqueid

2056.1.1.7. _createTmpFile

_createTmpFile()

open a temporary maildir file

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

Parameters:string – name of current folder without leading .
Throws ZendMailStorageExceptionRuntimeException:
 
Return type:array array(‘dirname’ => dir of maildir folder, ‘uniq’ => unique id, ‘filename’ => name of create file ‘handle’ => file opened for writing)

2056.1.1.8. _getInfoString

_getInfoString()

create an info string for filenames with given flags

Parameters:array – wanted flags, with the reference you’ll get the set flags with correct key (= char for flag)
Throws ZendMailStorageExceptionInvalidArgumentException:
 
Return type:string info string for version 2 filenames including the leading colon

2056.1.1.9. appendMessage

appendMessage()

append a new message to mail storage

Parameters:
  • string|stream – message as string or stream resource
  • null|string|ZendMailStorageFolder – folder for new message, else current folder is taken
  • null|array – set flags for new message, else a default set is used
  • bool – handle this mail as if recent flag has been set, should only be used in delivery
Throws ZendMailStorageExceptionRuntimeException:
 

2056.1.1.10. copyMessage

copyMessage()

copy an existing message

Parameters:
  • int – number of message
  • string|ZendMailStorageFolder – name or instance of targer folder
Throws ZendMailStorageExceptionRuntimeException:
 

2056.1.1.11. moveMessage

moveMessage()

move an existing message

Parameters:
  • int – number of message
  • string|ZendMailStorageFolder – name or instance of targer folder
Throws ZendMailStorageExceptionRuntimeException:
 

2056.1.1.12. setFlags

setFlags()

set flags for message

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

Parameters:
  • int – number of message
  • array – new flags for message
Throws ZendMailStorageExceptionRuntimeException:
 

2056.1.1.13. removeMessage

removeMessage()

stub for not supported message deletion

Parameters:$id
Throws ZendMailStorageExceptionRuntimeException:
 

2056.1.1.14. setQuota

setQuota()

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

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:bool|array – new quota value

2056.1.1.15. getQuota

getQuota()

get currently set quota

Parameters:bool
Throws ZendMailStorageExceptionRuntimeException:
 
Return type:bool|array

2056.1.1.16. _calculateMaildirsize

_calculateMaildirsize()

@see http://www.inter7.com/courierimap/README.maildirquota.html “Calculating maildirsize”

Return type:array

2056.1.1.17. _calculateQuota

_calculateQuota()

@see http://www.inter7.com/courierimap/README.maildirquota.html “Calculating the quota for a Maildir++”

Parameters:bool
Return type:array

2056.1.1.18. _addQuotaEntry

_addQuotaEntry()

2056.1.1.19. checkQuota

checkQuota()

check if storage is currently over quota

Parameters:
  • bool – return known data of quota and current size and message count
  • bool
Return type:

bool|array over quota state or detailed response