Advertisement
kangjaz

old_email

Mar 20th, 2018
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.98 KB | None | 0 0
  1. protected function _smtp_connect()
  2.     {
  3.         if (is_resource($this->_smtp_connect))
  4.         {
  5.             return TRUE;
  6.         }
  7.  
  8.         $ssl = ($this->smtp_crypto === 'ssl') ? 'ssl://' : '';
  9.  
  10.         $this->_smtp_connect = fsockopen($ssl.$this->smtp_host,
  11.                             $this->smtp_port,
  12.                             $errno,
  13.                             $errstr,
  14.                             $this->smtp_timeout);
  15.  
  16.         if ( ! is_resource($this->_smtp_connect))
  17.         {
  18.             $this->_set_error_message('lang:email_smtp_error', $errno.' '.$errstr);
  19.             return FALSE;
  20.         }
  21.  
  22.         stream_set_timeout($this->_smtp_connect, $this->smtp_timeout);
  23.         $this->_set_error_message($this->_get_smtp_data());
  24.  
  25.         if ($this->smtp_crypto === 'tls')
  26.         {
  27.             $this->_send_command('hello');
  28.             $this->_send_command('starttls');
  29.  
  30.             $crypto = stream_socket_enable_crypto($this->_smtp_connect, TRUE, STREAM_CRYPTO_METHOD_TLS_CLIENT);
  31.  
  32.             if ($crypto !== TRUE)
  33.             {
  34.                 $this->_set_error_message('lang:email_smtp_error', $this->_get_smtp_data());
  35.                 return FALSE;
  36.             }
  37.         }
  38.  
  39.         return $this->_send_command('hello');
  40.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement