1

I want to send email using SwiftMailer(v5.4.1) library in Yii1(1.1.17). here is my configuration for mailer component in main.php(configuration file):

'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',
        ),

Mail server and the application server are in internal network of our company.
When I attempt to send an email I receive this warning.
I want to know the reason and send emails after successfully did handshake with the server using startTLS(it is enabled in server, assured by network manager).

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      */
Mohamad Eghlima
  • 970
  • 10
  • 23
  • I have found this answer (http://stackoverflow.com/questions/26827192/phpmailer-ssl3-get-server-certificatecertificate-verify-failed) but it is for pure mail function, not for SwiftMailer in yii, but quite useful! – Mohamad Eghlima Feb 07 '16 at 21:20

0 Answers0