1819. Class

1819.1. Zend\Mail\Storage\Imap

1819.1.1. Methods

1819.1.1.1. countMessages

countMessages()

Count messages all messages in current box

Parameters:null
Throws ExceptionRuntimeException:
 
Throws ZendMailProtocolExceptionRuntimeException:
 
Return type:int number of messages

1819.1.1.2. getSize

getSize()

get a list of messages with number and size

Parameters:int – number of message
Return type:int|array size of given message of list with all messages as array(num => size)
Throws :ZendMailProtocolExceptionRuntimeException

1819.1.1.3. getMessage

getMessage()

Fetch a message

Parameters:int – number of message
Return type:ZendMailStorageMessage
Throws :ZendMailProtocolExceptionRuntimeException

1819.1.1.4. getRawHeader

getRawHeader()

1819.1.1.5. getRawContent

getRawContent()

1819.1.1.6. __construct

__construct()

create instance with parameters Supported parameters 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 – mail reader specific parameters
Throws ExceptionRuntimeException:
 
Throws ExceptionInvalidArgumentException:
 
Throws ZendMailProtocolExceptionRuntimeException:
 

1819.1.1.7. close

close()

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

1819.1.1.8. noop

noop()

Keep the server busy.

1819.1.1.9. removeMessage

removeMessage()

Remove a message from server. If you’re doing that from a web environment you should be careful and use a uniqueid as parameter if possible to identify the message.

Parameters:int – number of message
Throws ExceptionRuntimeException:
 

1819.1.1.10. getUniqueId

getUniqueId()

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 – message number
Return type:array|string message number for given message or all messages as array
Throws :ZendMailProtocolExceptionRuntimeException

1819.1.1.11. getNumberByUniqueId

getNumberByUniqueId()

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 – unique id
Throws ExceptionInvalidArgumentException:
 
Return type:int message number

1819.1.1.12. getFolders

getFolders()

get root folder or given folder

Parameters:string – get folder structure for given folder, else root
Throws ExceptionRuntimeException:
 
Throws ExceptionInvalidArgumentException:
 
Throws ZendMailProtocolExceptionRuntimeException:
 
Return type:ZendMailStorageFolder root or wanted folder

1819.1.1.13. selectFolder

selectFolder()

select given folder

folder must be selectable!

Parameters:ZendMailStorageFolder|string – global name of folder or instance for subfolder
Throws ExceptionRuntimeException:
 
Throws ZendMailProtocolExceptionRuntimeException:
 

1819.1.1.14. getCurrentFolder

getCurrentFolder()

get ZendMailStorageFolder instance for current folder

Return type:ZendMailStorageFolder instance of current folder

1819.1.1.15. 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 ExceptionRuntimeException:
 

1819.1.1.16. removeFolder

removeFolder()

remove a folder

Parameters:string|ZendMailStorageFolder – name or instance of folder
Throws ExceptionRuntimeException:
 

1819.1.1.17. 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 ExceptionRuntimeException:
 

1819.1.1.18. appendMessage

appendMessage()

append a new message to mail storage

Parameters:
  • string – message as string or instance of message class
  • 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
Throws ExceptionRuntimeException:
 

1819.1.1.19. copyMessage

copyMessage()

copy an existing message

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

1819.1.1.20. moveMessage

moveMessage()

move an existing message

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

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

1819.1.1.21. 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 ExceptionRuntimeException: