Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Class mailer does not exist

I updated my application from 5 to 5.2. Now when I call Mail::send() it return an exception Class mailer does not exist.

Mail::send('emails.mail', ['data' => $content], function ($m) use ($to, $subject,$toname) {

            $m->to($to, $toname)->subject($subject);


        });

When I open Illuminate\Support\Facades\Mail class there is only one function

protected static function getFacadeAccessor()
{
    return 'mailer';
}

Please help. If anyone have any idea

like image 921
Vijay Sebastian Avatar asked Jul 21 '16 11:07

Vijay Sebastian


2 Answers

Yes, I found the solution just put Illuminate\Mail\MailServiceProvider::class, in app.php providers

like image 76
Vijay Sebastian Avatar answered Sep 22 '22 22:09

Vijay Sebastian


Sometimes php artisan config:clear must be run in order to get rid of that kind of errors ("Class mailer does not exist").

I've migrated my project 1:1 (code, config, vhost) from old laptop to new one (Windows->Ubuntu) and I couldn't run the app without clearing config's cache.

like image 44
Wirone Avatar answered Sep 22 '22 22:09

Wirone