SMTP connection failing problem
PHP5.6 has enabled peer verification by default from 5.6.x. The most likely cause of this issue is that the SMTP server's SSL cert does not validate against the certs available to the hosting environment.

So, on PHP5.6+, an SMTP connection via SSL and TLS will fail in CiviCRM if the certificates are not peer verified. This is an issue either with the SMTP provider or your hosting environment's CA chain.

It is recommended instead to resolve the underlying issues with your hosting/SMTP service, but if you want to connect to a server with a self signed certificate (for example) you can patch CiviCRM to bypass this verification. 

Change in packages/Net/SMTP.php

line $this-&gt;_socket_options = $socket_options;

to $this-&gt;_socket_options = array('ssl' =&gt; array('verify_peer_name' =&gt; false));

Updated: I have updated the comment here since the summary in the ref link has also been updated to include:


  While not recommended in general, it is possible to disable peer certificate verification for a request by setting the verify_peer context option to FALSE, and to disable peer name validation by setting the verify_peer_name context option to FALSE.


The above works around the problem with SMTP failure however it is better to ensure the server is set up with valid SSL certificate and configurations.