1

我想SwiftMailer(v5.4.1)使用Yii1(1.1.17). 这是我在 main.php(配置文件)中对邮件组件的配置:

'mailer' => array(
            'class' => 'application.components.SwiftMailer',
            'host' => 'XX.XX.XX.XX',
            'type' => 'smtp',
            'port' => 587,
            'username' => 'username',
            'password' => 'password',
            'fromName' => 'sample_name',
            'fromAddress' => 'sample_email',
            'security' => 'tls',
        ),

邮件服务器和应用服务器在我公司的内部网络中。
当我尝试发送电子邮件时,我会收到此警告。
我想知道原因并在使用 startTLS 与服务器成功握手后发送电子邮件(它在服务器中启用,由网络管理员保证)。

stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

/home/mohammad/workspace/ir.wsi.recruitment/protected/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(95)

083                 case 'blocking':
084                     if ($this->_stream) {
085                         stream_set_blocking($this->_stream, 1);
086                     }
087 
088             }
089         }
090         $this->_params[$param] = $value;
091     }
092 
093     public function startTLS()
094     {
095 main error:     return stream_socket_enable_crypto($this->_stream, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
096     }
097 
098     /**
099      * Perform any shutdown logic needed.
100      */
101     public function terminate()
102     {
103         if (isset($this->_stream)) {
104             switch ($this->_params['type']) {
105                 case self::TYPE_PROCESS:
106                     fclose($this->_in);
107                     fclose($this->_out);

Stack Trace
#0  
–
 /home/mohammad/workspace/ir.wsi.recruitment/protected/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(95): stream_socket_enable_crypto(resource, true, 9)

090         $this->_params[$param] = $value;
091     }
092 
093     public function startTLS()
094     {
095         return stream_socket_enable_crypto($this->_stream, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
096     }
097 
098     /**
099      * Perform any shutdown logic needed.
100      */
4

0 回答 0