0
I am trying to send an email using the Standard.
I tried something like:
api.php:
Route::get('emailAnimalEncontrado', function () {
$data = array(
'name' => 'Novo animal encontrado em Franca. Você pode ajudá-lo?'
);
Mail::send('email', $data, function ($message){
$message->from('[email protected]', 'Novo animal encontrado em francaa.');
$message->to('[email protected]')->subject('teste email laravel');
});
return response()->json('Email enviado com sucesso', 201);
});
my file . env:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=SENHAEMAIL
MAIL_ENCRYPTION=null
In Resources/views/email.blade.php:
<html lang="pt-br">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
</head>
<body>
OI MUNDO
</body>
</html>
In mail.php:
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 465),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
'name' => env('MAIL_FROM_NAME', 'Renato Veronese'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('[email protected]'),
'password' => env('SENHAEMAIL'),
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
env('[email protected]')
??– Valdeir Psr
I changed to MAIL_USERNAME, remains the same problem.
– veroneseComS
Also has a
env('SENHAEMAIL')
lost there. Change and rotate thephp artisan config:cache
.– CypherPotato