- Модуль: mail
- Путь к файлу: ~/bitrix/modules/mail/classes/general/imap.php
- Класс: CMailImap
- Вызов: CMailImap::authenticate
public function authenticate($login, $password)
{
$tag = $this->sendCommand("AUTHENTICATE PLAINrn");
$prompt = $this->readLine();
if (mb_strpos($prompt, '+') !== 0)
{
if (mb_strpos($prompt, $tag.' NO') === 0 || mb_strpos($prompt, $tag.' BAD') === 0)
throw new Exception(GetMessage('MAIL_IMAP_ERR_AUTH_MECH'));
else
throw new Exception(GetMessage('MAIL_IMAP_ERR_AUTH').': '.GetMessage('MAIL_IMAP_ERR_BAD_SERVER'));
}
fputs($this->imap_stream, base64_encode("x00".$login."x00".$password)."rn");
$response = $this->readResponse($tag);
if (mb_strpos($response, $tag.' OK') === false)
{
if (mb_strpos($response, $tag.' NO') === 0 || mb_strpos($response, $tag.' BAD') === 0)
throw new Exception(GetMessage('MAIL_IMAP_ERR_AUTH'));
else
throw new Exception(GetMessage('MAIL_IMAP_ERR_AUTH').': '.GetMessage('MAIL_IMAP_ERR_BAD_SERVER'));
}
}