问题
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
回答1:
Yes, I found the solution
just put Illuminate\Mail\MailServiceProvider::class, in app.php providers
回答2:
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.
回答3:
Check where is you call \Debugbar::enable();, it happens when you enable debugbar in register method of service provider.
来源:https://stackoverflow.com/questions/38503654/laravel-class-mailer-does-not-exist