You need to add the mail package first
composer require illuminate\mail
Make sure you uncomment this
$app->register('App\Providers\AppServiceProvider'); to access the Mail ServiceProvider.
$app->withFacades(); to access the Mail facade.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Mail doesn't seem to work after Lumen 5.2 update.
I'm using the facade
use Illuminate\Support\Facades\Mail;
And this is the error I'm getting when trying to do Mail::send()
ReflectionException in Container.php line 736:
Class mailer does not exist
It seems like some sort of binding isn't done correctly. Does anyone know how to fix this in Lumen 5.2.x?
Hello Again!
I've managed to solve the mystery.
I've installed lumen, required the illuminate/mail package, edited the bootstrap/app.php uncommenting the:
$app->withFacades();
[...]
$app->register(App\Providers\AppServiceProvider::class);
and now it get's tricky.
Open up your app/Providers/AppServiceProvider.php and in the register method, add the following:
$this->app->singleton('mailer', function ($app) {
$app->configure('services');
return $app->loadComponent('mail', 'Illuminate\Mail\MailServiceProvider', 'mailer');
});
This will enable the Mail once again.
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
Once you have it in place, make sure to modify the 'from' key, otherwise you'll get Swift_TransportException.
Hope that helps anyone in the future!
Please or to participate in this conversation.