I'm having trouble sending mail with laravel 5.2. You are returning this error:
Expected response code 250 but got code "530",
with message "530-5.5.1 Authentication Required.
The file .env
looks like this:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=******
MAIL_ENCRYPTION=tls
The company's email domain is hosted on Google. I can log in to normal gmail with the email and password I put in .env
.
The file config/mail.php
looks like this:
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => '[email protected]', 'name' => 'teste'],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('[email protected]'),
'password' => env('****'),
'sendmail' => '/usr/sbin/sendmail -bs',
];
I'm sending emails like this:
Mail::send('emails.recuperar-senha', $dados, function ($message) {
$message->to(Input::get('email'));
});