61 $this->
connect($host, $port, $ssl);
82 public function connect($host, $port =
null, $ssl =
false)
85 $host =
'ssl://' . $host;
89 $port = $ssl ===
'SSL' ? 993 : 143;
94 $this->_socket = @
fsockopen($host, $port, $errno, $errstr, self::TIMEOUT_CONNECTION);
95 if (!$this->_socket) {
99 #require_once 'Zend/Mail/Protocol/Exception.php'; 101 ' (errno = ' . $errno .
' )');
108 #require_once 'Zend/Mail/Protocol/Exception.php'; 112 if ($ssl ===
'TLS') {
115 $result =
$result && stream_socket_enable_crypto($this->_socket,
true, STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT);
120 #require_once 'Zend/Mail/Protocol/Exception.php'; 134 $line = @fgets($this->_socket);
135 if ($line ===
false) {
139 #require_once 'Zend/Mail/Protocol/Exception.php'; 157 return strpos($line,
$start) === 0;
172 list($tag, $line) = explode(
' ', $line, 2);
204 $line = rtrim($line) .
' ';
205 while ((
$pos = strpos($line,
' ')) !==
false) {
207 while (
$token[0] ==
'(') {
213 if (preg_match(
'%^\(*"((.|\\\\|\\")*?)" *%', $line, $matches)) {
215 $line = substr($line, strlen($matches[0]));
220 $endPos = strpos(
$token,
'}');
221 $chars = substr(
$token, 1, $endPos - 1);
222 if (is_numeric($chars)) {
224 while (strlen(
$token) < $chars) {
228 if (strlen(
$token) > $chars) {
229 $line = substr(
$token, $chars);
235 $line = trim($line) .
' ';
244 $braces -= strlen(
$token) + 1;
246 if (rtrim(
$token) !=
'') {
252 while ($braces-- > 0) {
259 $line = substr($line,
$pos + 1);
294 return $tag == $wantedTag;
321 return $lines ? $lines :
true;
322 }
else if (
$tokens[0] ==
'NO'){
344 $line = $tag .
' ' . $command;
348 if (@fputs($this->_socket, $line .
' ' .
$token[0] .
"\r\n") ===
false) {
352 #require_once 'Zend/Mail/Protocol/Exception.php'; 359 #require_once 'Zend/Mail/Protocol/Exception.php'; 368 if (@fputs($this->_socket, $line .
"\r\n") ===
false) {
372 #require_once 'Zend/Mail/Protocol/Exception.php'; 403 if (func_num_args() < 2) {
404 if (strpos($string,
"\n") !==
false) {
405 return array(
'{' . strlen($string) .
'}', $string);
407 return '"' . str_replace(array(
'\\',
'"'), array(
'\\\\',
'\\"'), $string) .
'"';
411 foreach (func_get_args() as $string) {
426 foreach ($list as $k => $v) {
434 return '(' . implode(
' ',
$result) .
')';
458 if ($this->_socket) {
464 fclose($this->_socket);
465 $this->_socket =
null;
485 $capabilities = array();
487 $capabilities = array_merge($capabilities, $line);
489 return $capabilities;
572 if (is_array($from)) {
573 $set = implode(
',', $from);
574 }
else if ($to ===
null) {
576 }
else if ($to === INF) {
577 $set = (int)$from .
':*';
579 $set = (int)$from .
':' . (
int)$to;
585 $this->
sendRequest(
'FETCH', array($set, $itemList), $tag);
594 if ($to ===
null && !is_array($from) &&
$tokens[0] != $from) {
615 while (key(
$tokens[2]) !==
null) {
621 if ($to ===
null && !is_array($from) &&
$tokens[0] == $from) {
629 if ($to ===
null && !is_array($from)) {
633 #require_once 'Zend/Mail/Protocol/Exception.php'; 654 if (!$list || $list ===
true) {
658 foreach ($list as
$item) {
659 if (count(
$item) != 4 ||
$item[0] !=
'LIST') {
680 public function store(array $flags, $from, $to =
null,
$mode =
null, $silent =
true)
693 $set .=
':' . ($to == INF ?
'*' : (int)$to);
728 if ($flags !==
null) {
731 if ($date !==
null) {
748 public function copy($folder, $from, $to =
null)
752 $set .=
':' . ($to == INF ?
'*' : (int)$to);
787 public function delete($folder)
831 if ($ids[0] ==
'SEARCH') {
connect($host, $port=null, $ssl=false)
readResponse($tag, $dontParse=false)
fsockopen(&$errorNumber, &$errorMessage)
readLine(&$tokens=array(), $wantedTag=' *', $dontParse=false)
requestAndResponse($command, $tokens=array(), $dontParse=false)
store(array $flags, $from, $to=null, $mode=null, $silent=true)
append($folder, $message, $flags=null, $date=null)
sendRequest($command, $tokens=array(), &$tag=null)
fetch($items, $from, $to=null)
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
__construct($host='', $port=null, $ssl=false)
listMailbox($reference='', $mailbox=' *')
copy($folder, $from, $to=null)
examineOrSelect($command='EXAMINE', $box='INBOX')
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]