N
N
Nick Bukovskiy2017-09-12 11:49:11
gmail
Nick Bukovskiy, 2017-09-12 11:49:11

How to fix Swift_TransportException error when sending email?

.env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=MyPass
MAIL_ENCRYPTION=tls

mail.php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'from' => [address' => '[email protected]', 'name' => 'example',],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => ['theme' => 'default', 'paths' => [resource_path('views/vendor/mail'),],],
'pretend' => false,

web.php
Route::get('emailtest', function(){
    Mail::send('emails.mail', [], function ($message)
    {
      $message->to('[email protected]', 'HisName')->subject('Welcome!');
      $message->from('[email protected]','Test Tester');
    });
  });

I thought that everything was correct and double-checked it 100 times, but always the result is " Swift_TransportException
Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required".
What is my mistake? I would be glad for any help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2017-09-12
@sonterix

Maybe port 465?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question