我已阅读了很多关于如何使用流明发送邮件的指南和问题及解答。我已经尝试了很多这些建议。在流明发送邮件
不过,我仍然得到这个错误:
(1/1) FatalThrowableError
Type error: Too few arguments to function Illuminate\Support\Manager::createDriver(), 0 passed in /var/www/monitor/vendor/illuminate/support/Manager.php on line 88 and exactly 1 expected
完整的堆栈跟踪here。
这是我的控制器:
use Illuminate\Support\Facades\Mail;
public function check() {
$response = $this->getResponse();
if ($response) {
if ($this->isAlive($response->state)) {
$user = new \stdClass();
$user->email = '****@gmail.com';
$user->name = 'Albert';
Mail::raw('test', function($mail) use ($user) {
$mail->to($user->email, $user->name)->subject('Test Subject');
});
// I've also tried Mail::send() but no luck
echo 'System is fine';
} else {
echo 'System has issues';
}
} else {
echo 'Error connecting';
}
}
我已经注释掉,并添加以下行到我的bootstrap/app.php
:
$app->withFacades();
$app->register(App\Providers\AppServiceProvider::class);
$app->register(Illuminate\Mail\MailServiceProvider::class);
我有我的.env
文件中的以下内容:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=mygmailpassword
MAIL_ENCRYPTION=tls
我错过了什么吗?
你在线上有什么声明88 –