繁体   English   中英

当通知设置为作业时,Laravel 8 不会发送电子邮件通知

[英]Laravel 8 doesn't send an email notification when notifications are set to job

我正在尝试通过电子邮件发送通知。 只要我不想在工作中这样做,一切都很好。 当我向通知类添加implements ShouldQueue ,任务失败并出现错误Swift_TransportException: Cannot send message without a sender address in C: \\ Users \\ (...) \\ vendor \\ swiftmailer \\ swiftmailer \\ lib \\ classes \\ Swift \\ Transport \\ AbstractSmtpTransport.php: 195

当然env ,config (mail.from.address) 看到你需要什么,当我不尝试使用工作时,这通过正常邮件和通知确认。

默认通知.php

public function toMail($notifiable)
    {
        return (new MailMessage)
        ->line('The introduction to the notification.')
        ->action('Notification Action', url('/'))
        ->line('Thank you for using our application!');
}

我试过 add ->from('address@domain.com') ,没有工作也没关系。

请检查您的 smtp 设置

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM