I cant for the life of me figure out what the issue is with Magento using SMTP Pro connecting to gmail in google apps to send email from the site to customers. HTTPS on the site works if that makes any difference. I suspect some disconnect between openssl and php 5.6.

The Error I receive from SMTP Pro when running Self Test " SMTP Pro Self Test Results Sending test email to your contact form address: [email protected] from: [email protected]. Unable to send test email. Exception message was: Unable to connect via TLS Please check the user guide for frequent error messages and their solutions. Default templates exist. Email communications are enabled."

the config looks like:

Other logs from Magento are:

"ERR (3): 
exception 'Zend_Mail_Protocol_Exception' with message 'Unable to connect via TLS' in /var/www/html/mysite.com/lib/Zend/Mail/Protocol/Smtp.php:211
Stack trace:
#0 /var/www/html/mysite.com/lib/Zend/Mail/Transport/Smtp.php(200): Zend_Mail_Protocol_Smtp->helo('localhost')
#1 /var/www/html/mysite.com/lib/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Smtp->_sendMail()
#2 /var/www/html/mysite.com/lib/Zend/Mail.php(1194): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
#3 /var/www/html/mysite.com/app/code/local/Aschroder/SMTPPro/controllers/Smtp/TestController.php(136): Zend_Mail->send(Object(Zend_Mail_Transport_Smtp))
#4 /var/www/html/mysite.com/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Aschroder_SMTPPro_Smtp_TestController->indexAction()
#5 /var/www/html/mysite.com/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index')
#6 /var/www/html/mysite.com/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#7 /var/www/html/mysite.com/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#8 /var/www/html/mysite.com/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#9 /var/www/html/mysite.com/index.php(83): Mage::run('', 'store')
#10 {main}"

AND one more:

Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed  in /var/www/html/mysite.com/lib/Zend/Mail/Protocol/Smtp.php on line 206

Line 206 of the mentioned file is:

// If a TLS session is required, commence negotiation
if ($this->_secure == 'tls') {
    $this->_expect(220, 180);
    if (!stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
         * @see Zend_Mail_Protocol_Exception
        #require_once 'Zend/Mail/Protocol/Exception.php';
        throw new Zend_Mail_Protocol_Exception('Unable to connect via TLS');


Hoping someone out there know more than I do on this stuff. Thanks for any help/guidance that comes in

  • Some people have reported that enabling the extension php_openssl.dll from the php.ini on your environment fixes this issue, is this enabled do you know?
    – Muzza
    Commented Aug 2, 2015 at 20:25
  • its on a linux server so no dll. I have searched for the *nix equivalent, i think openssl.so. but no luck. I belive php is not using openssl but not sure how to tell for sure or how to change it if it isnt.
    – Toybreaker
    Commented Aug 4, 2015 at 10:17
  • 1
    Looking at the the repo for this extension, this was in the FAQ: Q: Self test is failing with "Exception message was: Unable to connect via TLS" A: Check that you have OpenSSL installed for your PHP environment. Check your php info, there is a good chance that its installed, just needs to be enabled. If so let me know and i can help!
    – Muzza
    Commented Aug 4, 2015 at 10:44
  • I found a similar question that mentioned that too. I have discovered since then is that Openssl is fully installed, PHP knows about it BUT curl is using NSS. I found in another question that if curl is not using Openssl then that is the issue but I suck at linux and have not had much luck figuring out how to fix it. Potential options we have explored:
    – Toybreaker
    Commented Aug 5, 2015 at 3:49
  • 1) recompile php with ssl switches - no longer seems to be necessary 2) Enable openssl in PHP- from what I can tell I need to tell it to use the extension openssl.so but that file does not exist on the system or anything similar to it 3) make curl use openssl - recompile curl to replace the NSS ssl any help appreciated
    – Toybreaker
    Commented Aug 5, 2015 at 3:56

3 Answers 3


The error you are getting from OpenSSL indicates that the SSL extension of PHP is compiled and loaded so no need to compile or load any .so or .dlls.

This is most likely a CA verfication issue - your SSL client (in this case PHP) is trying to verify the server's authenticity using root certificates; That's good - the only problem is this fails. Usually this means one of two things:

  1. The server does not present a valid SSL certificate; This is unlikely for a well established email provider, I'm guessing you're using Google so this is probably not the issue.

  2. More likely, your server does not have the up-to-date root certificates installed, or PHP does not know where they are. This is a configuration issue and solving it differs from server to server depending on your Linux distro and on how you installed PHP (e.g. from source, distro packages etc.). If you can provide more details about that, it may be possible to help.


If you are using Windows WAMP server, do following:

  1. Enable open_ssl php extension
  2. Download cacert.pem from https://curl.haxx.se/docs/caextract.html
  3. Specify its path in php.ini e.g: openssl.cafile="E:/wamp64/bin/php/php5.6.19/extras/ssl/cacert.pem"

Tu problema está en que si usas una cuenta de Gmail, aunque el servidor de gmail tiene un certificado válido, debes configurar en tu cuenta gmail la opción de seguridad y habilitar que vas a usar "aplicaciones menos seguras", y con eso te funciona.

"Set ON (Application Less Secure) in Gmail Account" ENJOY

Note: My english grammar s0x :D



Your problem is that if you use a Gmail account, although the gmail server has a valid certificate, you must configure in your gmail account the security option and enable you to use "less secure applications", and that works for you.

  • I've edited your post to add translation, please refrain from using language other than English/ add translation from google translate or something. Commented Dec 21, 2018 at 0:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.