title: Trying to get Laravel 5 email to work
body: <p>I'm trying to send an email to a specified user by typing in the URL, but I'm getting the following error:</p>
  
  <blockquote>
    <p>Swift_TransportException in AbstractSmtpTransport.php line 383:
    Expected response code 250 but got code "530", with message "530 5.7.1
    Authentication required</p>
  </blockquote>
  
  <p>So far I'm just trying to get it to work with Gmail.  How can I get this to work?</p>
  
  <p>This is what I have so far: <strong>mail.php</strong></p>
  
  <pre><code>&lt;?php
      return [
          'driver' =&gt; env('MAIL_DRIVER',' smtp'),
          'host' =&gt; env('MAIL_HOST', 'smtp.gmail.com'),
          'port' =&gt; env('MAIL_PORT', 587),
          'from' =&gt; ['address' =&gt;"MyUsername@gmail.com" , 'name' =&gt; "example"],
          'encryption' =&gt; 'tls',
          'username' =&gt; env('MyUsername@gmail.com'),
          'password' =&gt; env('MyPassword'),
          'sendmail' =&gt; '/usr/sbin/sendmail -bs',
          'pretend' =&gt; false,
      ];
  </code></pre>
  
  <p>This is what I have in the routes:</p>
  
  <pre><code>Route::get('test', function() {
      Mail::send('Email.test', [], function ($message) {
          $message-&gt;to('example@gmail.com', 'HisName')-&gt;subject('Welcome!');
      });
  });
  </code></pre>
  
  <p>This is what I have in my controller:</p>
  
  <pre><code>class MailController extends Controller
  {
      public function Sending_Email()
      {
          $this-&gt;call('GET','Email.test');
          return View('Email.test');
      }
  }
  </code></pre>
  
  <p>And this is what is in my .env file:</p>
  
  <pre><code>MAIL_DRIVER=smtp
  MAIL_HOST=smtp.gmail.com
  MAIL_PORT=587
  MAIL_USERNAME=MyUsername@gmail.com
  MAIL_PASSWORD=MyPassword
  </code></pre>