• Модуль: mail
  • Путь к файлу: ~/bitrix/modules/mail/lib/imap.php
  • Класс: BitrixMailImap
  • Вызов: Imap::getUIDsForSpecificDay
public function getUIDsForSpecificDay($dirPath, $internalDate)
{
	$error = [];

	if (!$this->select($dirPath, $error))
	{
		return false;
	}

	//since some mail services (example mail.ru ) do not support the 'on' search criterion
	$command = 'UID SEARCH SINCE '.date("j-M-Y", strtotime($internalDate)).' BEFORE '.date('j-M-Y', strtotime($internalDate.' +1 day'));

	$response = $this->executeCommand($command, $error);

	if ($error)
	{
		$error = $error == Imap::ERR_COMMAND_REJECTED ? null : $error;
		$error = $this->errorMessage(array(Imap::ERR_SEARCH, $error), $response);

		return false;
	}

	$UIDs = [];
	$regex = '/^ * x20 SEARCH x20 ( .+ ) rn $ /ix';
	foreach ($this->getUntagged($regex, true) as $item)
	{
		preg_match_all('/d+/', $item[1][1],$UIDs);
	}

	if(count($UIDs) === 0 )
	{
		return [];
	}

	return $UIDs[0];
}