0

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('test@mail.com')->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

alex
  • 51
  • 5

1 Answers1

0

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('test@mail.com')->send($mailsignup);
});
Leena Patel
  • 2,423
  • 1
  • 14
  • 28
  • But that's a package `vendor / symfony / mailer / Transport / AbstractTransport.php`, I should not edit files in vendor folder. – alex Nov 12 '22 at 13:30