I believe you already install lumen, Now we need ‘illuminate\mail’ for sending mail through lumen so here is how I configure SMTP mail with lumen.
1:- Install illuminate\mail to your lumen set up by entering the following command
composer require illuminate\mail
2:- Edited the bootstrap/app.php uncommenting the following lines
<?php
$app->withFacades();
And
<?php
$app->register(App\Providers\AppServiceProvider::class);
3:- Open up your app/Providers/AppServiceProvider.php and in the register method, add the following
<?php
$this->app->singleton('mailer', function ($app) {
$app->configure('services');
return $app->loadComponent('mail', 'Illuminate\Mail\MailServiceProvider', 'mailer');
});
This will enable the Mail
NOTE: If you haven’t got it already, you will need to copy/create the config/mail.php file:https://github.com/laravel/laravel/blob/master/config/mail.php
( Or you can get above file from laravel’s config directory )
Once you have it in place, make sure to modify the ‘from’ key, otherwise, you’ll get Swift_TransportException (An error Cannot send a message without a sender address ).