symfony Laravel发送邮件

xpcnnkqh  于 2022-11-16  发布在  其他
关注(0)|答案(1)|浏览(157)

我尝试发送电子邮件,但收到此错误
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'));
});

这是堆栈跟踪,它只使用Laravel包,路由旁边没有自定义代码。

我用composer updatecomposer upgrade更新后坏了

fjaof16o

fjaof16o1#

在路由中调用send()之前需要初始化MailSignup

Route::get('/test_mail', function (){
   $mailsignup = new MailSignup(array('field' => null), 'Test subject');
   Mail::to('test@mail.com')->send($mailsignup);
});

相关问题