yii2 Failed to authenticate on SMTP server with username using 2 possible authenticators
<p>I am using swift mailer in yii2, i am using correct smtp setting still not able to send email.
I got this error - Failed to authenticate on SMTP server with username "example@example.com" using 2 possible authenticators</p>

<p>my swift mailer settings are:</p>

<pre><code>'mailer' =&gt; [
        'class' =&gt; 'yii\swiftmailer\Mailer',
        'useFileTransport' =&gt; false,
        'transport' =&gt; [
            'class' =&gt; 'Swift_SmtpTransport',
            'host' =&gt; 'myHostName',
            'username' =&gt; 'myUsername',
            'password' =&gt; 'myPassword',
            'port' =&gt; '465',
            'encryption' =&gt; 'ssl',
        ],
    ],
</code></pre>

<p>I searched a lot on internet but found no solution, some people suggested that it would work by making 'useFileTransport' => false, but it is still not working.</p>