title: Yii swiftmailer fails to work in live server
body: <p>Am using yii2 and i have setup a mailer as follows</p>
  
  <pre><code>  &lt;?php
    return [
     'components' =&gt; [
    ....
      'mailer' =&gt; [
          'class' =&gt; 'yii\swiftmailer\Mailer',
          'viewPath' =&gt; '@common/mail',
          // send all mails to a file by default. You have to set
          // 'useFileTransport' to false and configure a transport
          // for the mailer to send real emails.
          'useFileTransport' =&gt; false,
          'transport' =&gt; [
              'class' =&gt; 'Swift_SmtpTransport',
              'host' =&gt; 'smtp.gmail.com',
              'username' =&gt; 'myemail@gmail.com',
              'password' =&gt; 'mygmailpassword',
              'port' =&gt; '465',
              'encryption' =&gt; 'ssl',
          ],
      ],
  ],
  </code></pre>
  
  <p>];</p>
  
  <p>The above works perfectly in localhost but fails when i upload to the live server i always get an error of bad credentials</p>
  
  <p>The error is </p>
  
  <pre><code>Swift_TransportException
  
   Expected response code 250 but got code "535", with message "535-5.7.8     
  Username and Password not accepted. Learn more at
  
  535 5.7.8 https://support.google.com/mail/?p=BadCredentials 
  r199sm3707144wme.1 - gsmtp
  </code></pre>
  
  <p>"</p>
  
  <p>What could be wrong,</p>