I've read a lot of guides and questions and answers on how to send mail using Lumen. I've tried a lot of these suggestions.
However, I still get this error:
(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
Full stack trace here.
This is my controller:
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';
}
}
I have uncommented and added the following lines to my bootstrap/app.php
:
$app->withFacades();
$app->register(App\Providers\AppServiceProvider::class);
$app->register(Illuminate\Mail\MailServiceProvider::class);
I've got the following in my .env
file:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=mygmailaddress@gmail.com
MAIL_PASSWORD=mygmailpassword
MAIL_ENCRYPTION=tls
Am I missing something?