engrlaravel's avatar

Mail::send not working in lumen

I am getting this error Unable to resolve NULL driver for [Illuminate\Mail\TransportManager]. on Manager.php on line 62.

i followed this link https://laravel.com/docs/5.7/mail

here is my env MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=587 [email protected] MAIL_PASSWORD=Abc@12345 MAIL_ENCRYPTION=tls

0 likes
14 replies
engrlaravel's avatar

@BOBBYBOUWMANN - Yes i followed https://lumen.laravel.com/docs/5.7/mail step by step. Nothing missing. Still i am getting this error, here is my bootstrap/app.php code

$app->withFacades();

$app->withEloquent();

$app->register(\Illuminate\Mail\MailServiceProvider::class);

$app->configure('services');

$app->configure('mail');

$app->alias('mailer', Illuminate\Mail\Mailer::class);

$app->alias('mailer', Illuminate\Contracts\Mail\Mailer::class);

$app->alias('mailer', Illuminate\Contracts\Mail\MailQueue::class);

bobbybouwmann's avatar

Everything looks correct. Also make sure that you perform the configure calls at the end of app.php. That is sometimes the problem

// All other stuff

$app->configure('services');
$app->configure('mail');
engrlaravel's avatar

@BOBBYBOUWMANN - Hi,

I already tried these lines as well

  $app->configure('services');
  $app->configure('mail');

BUT not luck..

Any other solution or option??

williamxsp's avatar

Just a try, remove these lines:

$app->alias('mailer', Illuminate\Mail\Mailer::class);

$app->alias('mailer', Illuminate\Contracts\Mail\Mailer::class);

$app->alias('mailer', Illuminate\Contracts\Mail\MailQueue::class);
bobbybouwmann's avatar

No clue. Is the illuminate/mail package installed at all?

composer install illuminate/mail
bobbybouwmann's avatar

Mmh no clue. Do you have your project on github? Maybe we can look into it that way? It can be anything at this point

bobbybouwmann's avatar
Level 88

Aah I see the problem! You didn't create a config/mail.php file in your project!

It's definitely in the documentation!!

Next, configure your mail options by copying the mail.php configuration file from the full Laravel framework to the config directory in the root of your project. Of course, you are free to adjust the configuration options as needed. If your Lumen application does not contain a config directory, you should create it.

After that everything was running on my machine!

1 like
engrlaravel's avatar

Aah, mail.php path was app/config/mail.php, it should be at the root.

2 likes

Please or to participate in this conversation.