Search code examples
phplaravelphpmailer

Laravel Method Illuminate\Mail\Mailer::test does not exist


In my laravel project i use mailgun and guzzlehttp/guzzle. My route code is

 Route::get('/', function () {
    $data = [
      'title'=>'Hellow Avijit',
      'content'=>'This is a testing of mailing in Laravel using mailgun'
    ];

    Mail::test('emails.test', $data, function($message) {
        $message->to('[email protected]', 'Avijit Biswas')
            ->subject('This is Subject');
    });
});

I use

use Illuminate\Support\Facades\Mail;

But after running the project it is seen

Method Illuminate\Mail\Mailer::test does not exist.

I have tried a lot to solve this but i didn't get any solution. What can i do?


Solution

  • Use Mail::send() instead of Mail::test()

    Because send() is the inbuilt function in Mail.