.env
MAIL_DRIVER=smtp 服务
MAIL_HOST=smtp.qq.com 服务提供方
MAIL_PORT=465 服务端口
MAIL_USERNAME=***@qq.com
MAIL_PASSWORD=填写授权码
MAIL_ENCRYPTION=ssl
configmail.php
'from' => [
'address' => '1296853739@qq.com',
'name' => 'dylan',
],
测试
Mail::send('emails.welcome', ['user'=>$user], function ($message) {
// $message->from('john@johndoe.com', 'John Doe');
$message->to('1296853739@qq.com', 'John Doe');
$message->subject('whilec com to you');
});
注意点:
MAIL_ENCRYPTION=ssl即使网站没有ssl证书也可以这么设置
password必须是smtp的授权码而不是qq密码
请确保开启了这一服务
具体的可以看我写的文章
https://www.nasuiyile.cn/34.html
以上全部代码亲测有效