Swift_TransportException in Laravel 5.2 mail sending
<p>I am trying to send mail for my laravel app from a gmail account with <strong>Allow less secure apps: ON</strong> and <strong>2-Step Verification OFF</strong></p>

<p><em>.env</em> part for mail: </p>

<pre><code>MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=library@gmail.com
MAIL_PASSWORD=********
MAIL_ENCRYPTION=ssl
</code></pre>

<p><em>config/mail.php</em>:</p>

<pre><code>'driver' =&gt; env('MAIL_DRIVER', 'smtp'),
'host' =&gt; env('MAIL_HOST', 'smtp.gmail.com'),
'port' =&gt; env('MAIL_PORT', 587),
'from' =&gt; ['address' =&gt; 'library@gmail.com', 'name' =&gt; 'Admin'],
'encryption' =&gt; env('MAIL_ENCRYPTION', 'ssl'),
'username' =&gt; env('library@gmail.com'),
'password' =&gt; env('********'),
'sendmail' =&gt; '/usr/sbin/sendmail -bs',
'pretend' =&gt; env('MAIL_PRETEND', false),
</code></pre>

<p>First I tried using <code>'encryption' =&gt; env('MAIL_ENCRYPTION','tls')</code>. But got the following error message: </p>

<pre><code>ERROR: exception 'Swift_TransportException' with message 'Expected
response code 250 but got code "530", with message "530-5.5.1
Authentication Required. Learn more at 
530 5.5.1  https://support.google.com/mail/answer/14257  
z3sm16020712par.17 - gsmtp"' in
/home/shafi/Projects/Lib/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:383
</code></pre>

<p>I visited <a href="https://support.google.com/mail/answer/14257">https://support.google.com/mail/answer/14257</a> and found everything is at the recommended state.</p>

<p>After this I used <code>'encryption' =&gt; env('MAIL_ENCRYPTION','ssl')</code> but this time the same <strong>ERROR</strong>. </p>

<p>What should I do to fix the error? What am I missing? </p>