• Модуль: mail
  • Путь к файлу: ~/bitrix/modules/mail/lib/smtp.php
  • Класс: BitrixMailSmtp
  • Вызов: Smtp::capability
protected function capability(&$error)
{
	$error = null;

	if (!$this->stream)
	{
		$error = $this->errorMessage(Smtp::ERR_CAPABILITY);
		return false;
	}

	$response = $this->executeCommand(
		sprintf(
			'EHLO %s',
			MainContext::getCurrent()->getRequest()->getHttpHost() ?: 'localhost'
		),
		$error
	);

	if ($error || !is_array($response))
	{
		$error = $error == Smtp::ERR_COMMAND_REJECTED ? null : $error;
		$error = $this->errorMessage(array(Smtp::ERR_CAPABILITY, $error), $response ? trim(end($response)) : null);

		return false;
	}

	$this->sessCapability = array_map(
		function ($line)
		{
			return trim(mb_substr($line, 4));
		},
		$response
	);

	return true;
}