|
| countMessages ($flags=null) |
|
| getSize ($id=0) |
|
| getMessage ($id) |
|
| getRawHeader ($id, $part=null, $topLines=0) |
|
| getRawContent ($id, $part=null) |
|
| __construct ($params) |
|
| close () |
|
| noop () |
|
| removeMessage ($id) |
|
| getUniqueId ($id=null) |
|
| getNumberByUniqueId ($id) |
|
| getFolders ($rootFolder=null) |
|
| selectFolder ($globalName) |
|
| getCurrentFolder () |
|
| createFolder ($name, $parentFolder=null) |
|
| removeFolder ($name) |
|
| renameFolder ($oldName, $newName) |
|
| appendMessage ($message, $folder=null, $flags=null) |
|
| copyMessage ($id, $folder) |
|
| moveMessage ($id, $folder) |
|
| setFlags ($id, $flags) |
|
| __get ($var) |
|
| getCapabilities () |
|
| countMessages () |
|
| getSize ($id=0) |
|
| getMessage ($id) |
|
| getRawHeader ($id, $part=null, $topLines=0) |
|
| getRawContent ($id, $part=null) |
|
| __construct ($params) |
|
| __destruct () |
|
| close () |
|
| noop () |
|
| removeMessage ($id) |
|
| getUniqueId ($id=null) |
|
| getNumberByUniqueId ($id) |
|
| count () |
|
| offsetExists ($id) |
|
| offsetGet ($id) |
|
| offsetSet ($id, $value) |
|
| offsetUnset ($id) |
|
| rewind () |
|
| current () |
|
| key () |
|
| next () |
|
| valid () |
|
| seek ($pos) |
|
Definition at line 66 of file Imap.php.
◆ __construct()
create instance with parameters Supported paramters 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 | $params | mail reader specific parameters |
- Exceptions
-
- See also
- Zend_Mail_Storage_Exception
-
Zend_Mail_Storage_Exception
-
Zend_Mail_Storage_Exception
Definition at line 239 of file Imap.php.
245 $this->_has[
'flags'] =
true;
255 #require_once 'Zend/Mail/Storage/Exception.php'; 265 #require_once 'Zend/Mail/Storage/Exception.php'; 275 $this->_protocol->connect($host, $port, $ssl);
276 if (!$this->_protocol->login(
$params->user, $password)) {
280 #require_once 'Zend/Mail/Storage/Exception.php'; selectFolder($globalName)
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
◆ appendMessage()
appendMessage |
( |
|
$message, |
|
|
|
$folder = null , |
|
|
|
$flags = null |
|
) |
| |
append a new message to mail storage
- Parameters
-
string | $message | message as string or instance of message class |
null | string | Zend_Mail_Storage_Folder | $folder | folder for new message, else current folder is taken |
null | array | $flags | set flags for new message, else a default set is used |
- Exceptions
-
- See also
- Zend_Mail_Storage_Exception
Implements Zend_Mail_Storage_Writable_Interface.
Definition at line 572 of file Imap.php.
574 if ($folder ===
null) {
578 if ($flags ===
null) {
583 if (!$this->_protocol->append($folder,
$message, $flags)) {
587 #require_once 'Zend/Mail/Storage/Exception.php';
◆ close()
Close resource for mail lib. If you need to control, when the resource is closed. Otherwise the destructor would call this.
- Returns
- null
Definition at line 292 of file Imap.php.
294 $this->_currentFolder =
'';
295 $this->_protocol->logout();
◆ copyMessage()
copyMessage |
( |
|
$id, |
|
|
|
$folder |
|
) |
| |
◆ countMessages()
countMessages |
( |
|
$flags = null | ) |
|
Count messages all messages in current box
- Returns
- int number of messages
- Exceptions
-
- See also
- Zend_Mail_Storage_Exception
Definition at line 115 of file Imap.php.
117 if (!$this->_currentFolder) {
121 #require_once 'Zend/Mail/Storage/Exception.php'; 125 if ($flags ===
null) {
126 return count($this->_protocol->search(array(
'ALL')));
130 foreach ((array)$flags as $flag) {
131 if (isset(self::$_searchFlags[$flag])) {
132 $params[] = self::$_searchFlags[$flag];
135 $params[] = $this->_protocol->escapeString($flag);
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
◆ createFolder()
createFolder |
( |
|
$name, |
|
|
|
$parentFolder = null |
|
) |
| |
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 | $name | global name of folder, local name if $parentFolder is set |
string | Zend_Mail_Storage_Folder | $parentFolder | parent folder for new folder, else root folder is parent |
- Returns
- null
- Exceptions
-
- See also
- Zend_Mail_Storage_Exception
Implements Zend_Mail_Storage_Writable_Interface.
Definition at line 496 of file Imap.php.
500 $folder = $parentFolder->getGlobalName() .
'/' .
$name;
501 }
else if ($parentFolder !=
null) {
502 $folder = $parentFolder .
'/' .
$name;
507 if (!$this->_protocol->create($folder)) {
511 #require_once 'Zend/Mail/Storage/Exception.php';
if(!isset($_GET['name'])) $name
◆ getCurrentFolder()
◆ getFolders()
getFolders |
( |
|
$rootFolder = null | ) |
|
get root folder or given folder
- Parameters
-
string | $rootFolder | get folder structure for given folder, else root |
- Returns
- Zend_Mail_Storage_Folder root or wanted folder
- Exceptions
-
- See also
- Zend_Mail_Storage_Exception
-
Zend_Mail_Storage_Exception
Implements Zend_Mail_Storage_Folder_Interface.
Definition at line 397 of file Imap.php.
399 $folders = $this->_protocol->listMailbox((
string)$rootFolder);
404 #require_once 'Zend/Mail/Storage/Exception.php'; 408 ksort($folders, SORT_STRING);
410 $stack = array(
null);
411 $folderStack = array(
null);
412 $parentFolder = $root;
415 foreach ($folders as $globalName =>
$data) {
417 if (!$parent || strpos($globalName, $parent) === 0) {
418 $pos = strrpos($globalName,
$data[
'delim']);
419 if (
$pos ===
false) {
420 $localName = $globalName;
422 $localName = substr($globalName,
$pos + 1);
424 $selectable = !
$data[
'flags'] || !in_array(
'\\Noselect',
$data[
'flags']);
426 array_push($stack, $parent);
427 $parent = $globalName .
$data[
'delim'];
429 $parentFolder->$localName = $folder;
430 array_push($folderStack, $parentFolder);
431 $parentFolder = $folder;
434 $parent = array_pop($stack);
435 $parentFolder = array_pop($folderStack);
442 #require_once 'Zend/Mail/Storage/Exception.php';
◆ getMessage()
Fetch a message
- Parameters
-
- Returns
- Zend_Mail_Message
- Exceptions
-
Definition at line 163 of file Imap.php.
165 $data = $this->_protocol->fetch(array(
'FLAGS',
'RFC822.HEADER'),
$id);
166 $header =
$data[
'RFC822.HEADER'];
169 foreach (
$data[
'FLAGS'] as $flag) {
170 $flags[] = isset(self::$_knownFlags[$flag]) ? self::$_knownFlags[$flag] : $flag;
173 return new $this->_messageClass(array(
'handler' => $this,
'id' =>
$id,
'headers' => $header,
'flags' => $flags));
◆ getNumberByUniqueId()
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
-
- Returns
- int message number
- Exceptions
-
- See also
- Zend_Mail_Storage_Exception
Definition at line 371 of file Imap.php.
375 foreach ($ids as $k => $v) {
384 #require_once 'Zend/Mail/Storage/Exception.php';
◆ getRawContent()
getRawContent |
( |
|
$id, |
|
|
|
$part = null |
|
) |
| |
- See also
- Zend_Mail_Storage_Exception
Definition at line 211 of file Imap.php.
213 if ($part !==
null) {
218 #require_once 'Zend/Mail/Storage/Exception.php'; 222 return $this->_protocol->fetch(
'RFC822.TEXT',
$id);
◆ getRawHeader()
getRawHeader |
( |
|
$id, |
|
|
|
$part = null , |
|
|
|
$topLines = 0 |
|
) |
| |
- See also
- Zend_Mail_Storage_Exception
Definition at line 187 of file Imap.php.
189 if ($part !==
null) {
194 #require_once 'Zend/Mail/Storage/Exception.php'; 199 return $this->_protocol->fetch(
'RFC822.HEADER',
$id);
◆ getSize()
get a list of messages with number and size
- Parameters
-
- Returns
- int|array size of given message of list with all messages as array(num => size)
- Exceptions
-
Definition at line 148 of file Imap.php.
151 return $this->_protocol->fetch(
'RFC822.SIZE',
$id);
153 return $this->_protocol->fetch(
'RFC822.SIZE', 1, INF);
◆ getUniqueId()
getUniqueId |
( |
|
$id = null | ) |
|
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 | $id | message number |
- Returns
- array|string message number for given message or all messages as array
- Exceptions
-
Definition at line 352 of file Imap.php.
355 return $this->_protocol->fetch(
'UID',
$id);
358 return $this->_protocol->fetch(
'UID', 1, INF);
◆ moveMessage()
moveMessage |
( |
|
$id, |
|
|
|
$folder |
|
) |
| |
move an existing message
NOTE: imap has no native move command, thus it's emulated with copy and delete
- Parameters
-
- Returns
- null
- Exceptions
-
Implements Zend_Mail_Storage_Writable_Interface.
Definition at line 621 of file Imap.php.
copyMessage($id, $folder)
◆ noop()
Keep the server busy.
- Returns
- null
- Exceptions
-
- See also
- Zend_Mail_Storage_Exception
Definition at line 304 of file Imap.php.
306 if (!$this->_protocol->noop()) {
310 #require_once 'Zend/Mail/Storage/Exception.php';
◆ removeFolder()
◆ removeMessage()
Remove a message from server. If you're doing that from a web enviroment you should be careful and use a uniqueid as parameter if possible to identify the message.
- Parameters
-
- Returns
- null
- Exceptions
-
- See also
- Zend_Mail_Storage_Exception
-
Zend_Mail_Storage_Exception
Definition at line 324 of file Imap.php.
330 #require_once 'Zend/Mail/Storage/Exception.php'; 334 if (!$this->_protocol->expunge()) {
338 #require_once 'Zend/Mail/Storage/Exception.php';
◆ renameFolder()
renameFolder |
( |
|
$oldName, |
|
|
|
$newName |
|
) |
| |
◆ selectFolder()
selectFolder |
( |
|
$globalName | ) |
|
select given folder
folder must be selectable!
- Parameters
-
- Returns
- null
- Exceptions
-
- See also
- Zend_Mail_Storage_Exception
Implements Zend_Mail_Storage_Folder_Interface.
Definition at line 460 of file Imap.php.
462 $this->_currentFolder = $globalName;
463 if (!$this->_protocol->select($this->_currentFolder)) {
464 $this->_currentFolder =
'';
468 #require_once 'Zend/Mail/Storage/Exception.php';
◆ setFlags()
◆ $_currentFolder
◆ $_knownFlags
Initial value:
Definition at line 88 of file Imap.php.
◆ $_protocol
◆ $_searchFlags
Initial value:= array('\Recent' => 'RECENT',
'\Answered' => 'ANSWERED',
'\Seen' => 'SEEN',
'\Unseen' => 'UNSEEN',
'\Deleted' => 'DELETED',
'\Draft' => 'DRAFT',
'\Flagged' => 'FLAGGED')
Definition at line 100 of file Imap.php.
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Mail/Storage/Imap.php