错误 - 缺少Illuminate \ Support \ Manager :: createDriver()
的参数1我的环境文件 -
MAIL_DRIVER=smtp
MAIL_HOST=smtp.****.com
MAIL_PORT=587
MAIL_USERNAME=info@*****.com
MAIL_PASSWORD=******
MAIL_ENCRYPTION=tls
config文件夹的mail.php中的所有键都是正确的。
我的控制器功能如下所示
function send(Request $request)
{
$this->validate($request,[
'name'=>'required',
'email'=>'required|email',
'subject'=>'required',
'message'=>'min:10'
]);
$data=array(
'name'=>$request->name,
'email'=>$request->email,
'subject'=>$request->subject,
'bodyMessage'=>$request->message
);
Mail::send('mail.admin',$data,function($message) use ($data)
{
$message->from($data['email']);
$message->to($data['info@****.com']);
$message->subject($data['subject']);
});
}
我在这里犯了什么错误?
这是我的mail.php文件
<?php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.****.com'),
'port' => env('MAIL_PORT', 587),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs', 'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
答案 0 :(得分:0)
我用自己的代码替换了所有设置和代码,并且电子邮件已正确发送。我建议删除composer.lock
文件并删除vendor
目录并再次运行composer install
。也许没有安装完整的包。