I've been learning laravel and got stuck on the mail function, I have my config files configured properly but the mail is not sending and not giving errors.. I also enabled the APP_DEBUG mode in my app.php file also on the .env file, tried to restart apache server and clear app cache. I'm trying to fix this issue for about three days now and I cannot make the email function work properly. I hope any one here could help me with this.. below are my codes.
mail.php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'gator.hostgator.com'),
'port' => env('MAIL_PORT', 587),
'from' => [
'address' => 'myemail@solve.life',
'name' => 'Hero Directory',
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('myemail@solve.life'),
'password' => env('mypassword'),
'sendmail' => '/usr/sbin/sendmail -bs',
];
.env
MAIL_DRIVER=smtp
MAIL_HOST=gator.hostgator.com
MAIL_PORT=465
MAIL_USERNAME=myemail@solve.life
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=ssl
UserController
$data = ['email' => $email, 'full_name' => $full_name, 'confirmation_code' => $confirmation_code];
$mail_verification = Mail::send('email.verify',$data, function($message) use ($data){
$message->to($data['email'], $data['full_name']);
$message->subject('Verify your email address');
});