我在 Laravel 5.5 中实现邮件时遇到此错误----> Illuminate\Support\Manager::createDriver() 缺少参数 1
I am getting this error while implementing Mail in Laravel 5.5---->Missing argument 1 for Illuminate\Support\Manager::createDriver()
错误 - 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'),
],
],
];
我用自己的代码替换了所有设置和代码,并且电子邮件已正确发送。我建议删除 composer.lock
文件并再次删除 vendor
目录和 运行 和 composer install
。可能没有安装完整的包。
错误 - 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'),
],
],
];
我用自己的代码替换了所有设置和代码,并且电子邮件已正确发送。我建议删除 composer.lock
文件并再次删除 vendor
目录和 运行 和 composer install
。可能没有安装完整的包。