當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CakeSocket::enableCrypto方法代碼示例

本文整理匯總了PHP中CakeSocket::enableCrypto方法的典型用法代碼示例。如果您正苦於以下問題:PHP CakeSocket::enableCrypto方法的具體用法?PHP CakeSocket::enableCrypto怎麽用?PHP CakeSocket::enableCrypto使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CakeSocket的用法示例。


在下文中一共展示了CakeSocket::enableCrypto方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _connect

 /**
  * Connect to SMTP Server
  *
  * @return void
  * @throws SocketException
  */
 protected function _connect()
 {
     $this->_generateSocket();
     if (!$this->_socket->connect()) {
         throw new SocketException(__d('cake_dev', 'Unable to connect to SMTP server.'));
     }
     $this->_smtpSend(null, '220');
     if (isset($this->_config['client'])) {
         $host = $this->_config['client'];
     } elseif ($httpHost = env('HTTP_HOST')) {
         list($host) = explode(':', $httpHost);
     } else {
         $host = 'localhost';
     }
     try {
         $this->_smtpSend("EHLO {$host}", '250');
         if ($this->_config['tls']) {
             $this->_smtpSend("STARTTLS", '220');
             $this->_socket->enableCrypto('tls');
             $this->_smtpSend("EHLO {$host}", '250');
         }
     } catch (SocketException $e) {
         if ($this->_config['tls']) {
             throw new SocketException(__d('cake_dev', 'SMTP server did not accept the connection or trying to connect to non TLS SMTP server using TLS.'));
         }
         try {
             $this->_smtpSend("HELO {$host}", '250');
         } catch (SocketException $e2) {
             throw new SocketException(__d('cake_dev', 'SMTP server did not accept the connection.'));
         }
     }
 }
開發者ID:thanphong,項目名稱:do-an-tot-nghiep-project,代碼行數:38,代碼來源:SmtpTransport.php


注:本文中的CakeSocket::enableCrypto方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。