我一直在学习laravel并且卡在邮件功能上, 我的配置文件配置正确,但邮件没有发送,也没有给出错误..我也在.env文件中的app.php文件中启用了APP_DEBUG模式,尝试重新启动apache服务器并清除应用程序缓存。我现在试图解决这个问题大约三天,我无法使电子邮件功能正常工作。我希望这里的任何人都可以帮助我..下面是我的代码。
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');
});