SMTP Connect
string Core_Email::_smtp_connect( )
string
protected function _smtp_connect()
{
$ssl = ($this->smtp_crypto === 'ssl') ? 'ssl://' : null;
$this->_smtp_connect = fsockopen($ssl.$this->smtp_host,
$this->smtp_port,
$errno,
$errstr,
$this->smtp_timeout);
if ( ! is_resource($this->_smtp_connect))
{
$this->_set_error_message('lang:email_smtp_error', $errno.' '.$errstr);
return false;
}
$this->_set_error_message($this->_get_smtp_data());
if ($this->smtp_crypto === 'tls')
{
$this->_send_command('hello');
$this->_send_command('starttls');
$crypto = stream_socket_enable_crypto($this->_smtp_connect, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
if ($crypto !== true)
{
$this->_set_error_message('lang:email_smtp_error', $this->_get_smtp_data());
return false;
}
}
return $this->_send_command('hello');
}