- Модуль: mail
- Путь к файлу: ~/bitrix/modules/mail/lib/imap.php
- Класс: BitrixMailImap
- Вызов: Imap::searchByHeader
public function searchByHeader($uid, $mailbox, array $header, &$error)
{
$error = null;
if (!$this->select($mailbox, $error))
{
return false;
}
if (empty($header))
{
return false;
}
$result = array();
$response = $this->executeCommand(
$ccc = sprintf(
'%sSEARCH %s', $uid ? 'UID ' : '',
join(
' ',
array_map(
function ($name, $value)
{
return sprintf(
'HEADER %s %s',
static::prepareString($name),
static::prepareString($value)
);
},
array_keys($header),
array_values($header)
)
)
),
$error
);
if ($error)
{
$error = $error == Imap::ERR_COMMAND_REJECTED ? null : $error;
$error = $this->errorMessage(array(Imap::ERR_SEARCH, $error), $response);
return false;
}
$regex = '/^ * x20 SEARCH x20 ( .+ ) rn $ /ix';
foreach ($this->getUntagged($regex, true) as $item)
{
$result = preg_match_all('/d+/', $item[1][1]);
}
return $result;
}