Mautic unable to connect with TLS. SMTP
<p>I'm stuck on this one.  I'm working on a project to automatically deploy and configure Mautic instances on AWS's Elastic Beanstalk using Docker containers.  Everything appears to be in order, but when I click the "Test Connection" in the email settings of Mautic's configuration, I always get "Unable to connect with TLS encryption."</p>

<p>If I don't use any encryption, I'm able to connect just fine and send emails.  So it's not a blocked port issue or bad credentials.</p>

<p>I've made sure OpenSSL is installed and running in PHP.</p>

<p>Mautic is using swiftmailer to send emails, so I went into their code, and copied the exact snippet of code they use to test.  I inserted this into a test script like so, and ran it.</p>

<pre><code>&lt;?php
require_once __DIR__ . '/vendor/autoload.php';
try {
$mailer = new \Swift_SmtpTransport('...', 587, 'tls');
$mailer-&gt;setUsername('...');
$mailer-&gt;setPassword('...');

$mailer-&gt;start();
die('hello');
}
catch(Exception $e){
echo $e-&gt;getMessage();
}
</code></pre>

<p>That works fine.  I went so far as adding the rest of the code needed to send the email, and it came to my mailbox just fine.  This script was executed from inside the docker container that's on the AWS Elastic Beanstalk server.</p>

<p>So what am I missing?  Why is this failing me when testing through mautic?</p>

<p>The test script also uses the same <code>vendor</code> folder that the Mautic instance is using so I know it's using the exact same version of SwiftMailer.</p>

<p>Thanks</p>

<p>==</p>

<h1>UPDATE 1</h1>

<p>Downgrading to PHP 5.5 from PHP 5.6 seems to have resolved this issue, but I don't like the idea of downgrading PHP just to solve a problem.  I got the idea from this <a href="https://github.com/fguillot/kanboard/issues/1484" rel="nofollow">issue</a>  </p>

<p>So if anyone has a better solution, I'm still open.  I do notice in the issue, someone has pointed out a solution for 5.6, but it involves editing vendor files, which doesn't work for me since I'm trying to automate all of this.</p>