我已閱讀了很多關於如何使用流明發送郵件的指南和問題及解答。我已經嘗試了很多這些建議。在流明發送郵件
不過,我仍然得到這個錯誤:
(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 –