This question already has an answer here:
Ok guys, I'm setting up an email project in Laravel, on my local computer, when I set up the .env file with a Gmail account the emails arrive correctly.
But when I use the actual project settings, the host data (HostGator), no email arrives;
I don't get any php errors, everything works normally, but no email arrives. My code below:
// .env
MAIL_DRIVER=smtp
MAIL_HOST=srv16.prodns.com.br
MAIL_PORT=465
MAIL_USERNAME=noreply@mywebsite.com
MAIL_PASSWORD=*******
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=noreply@mywebsite.com
// mail.php
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'noreply@mywebsite.com'),
'name' => env('MAIL_FROM_NAME', 'New message'),
],
// Controller
\Mail::to($email)->send(new NewMessage($body));