SMTP Authenticate
bool Core_Email::_smtp_authenticate( )
bool
protected function _smtp_authenticate()
{
if ( ! $this->_smtp_auth)
{
return true;
}
if ($this->smtp_user === '' && $this->smtp_pass === '')
{
$this->_set_error_message('lang:email_no_smtp_unpw');
return false;
}
$this->_send_data('AUTH LOGIN');
$reply = $this->_get_smtp_data();
if (strpos($reply, '334') !== 0)
{
$this->_set_error_message('lang:email_failed_smtp_login', $reply);
return false;
}
$this->_send_data(base64_encode($this->smtp_user));
$reply = $this->_get_smtp_data();
if (strpos($reply, '334') !== 0)
{
$this->_set_error_message('lang:email_smtp_auth_un', $reply);
return false;
}
$this->_send_data(base64_encode($this->smtp_pass));
$reply = $this->_get_smtp_data();
if (strpos($reply, '235') !== 0)
{
$this->_set_error_message('lang:email_smtp_auth_pw', $reply);
return false;
}
return true;
}