Home > OS >  Laravel send mail
Laravel send mail

Time:11-15

I'm trying to send an email and I get this error

Typed property Symfony\Component\Mailer\Transport\AbstractTransport::$dispatcher must not be accessed before initialization

use Illuminate\Support\Facades\Mail; use App\Mail\Signups as MailSignup;

Route::get('/test_mail', function (){
    Mail::to('[email protected]')->send(new MailSignup(array('field' => null), 'Test subject'));
});

This is the stack trace, it uses just Laravel packages, no custom code beside the route.

enter image description here

It broke after I updated with composer update and composer upgrade

CodePudding user response:

You need to initialize MailSignup before calling send() in route

Route::get('/test_mail', function (){
   $mailsignup = new MailSignup(array('field' => null), 'Test subject');
   Mail::to('[email protected]')->send($mailsignup);
});
  • Related