阅读(459) (0)

Laravel 8 自定义邮件发送驱动

2021-07-06 09:24:41 更新

默认情况下,邮件通知将使用 config/mail.php 配置文件中定义的默认驱动程序发送。但是,你可以在运行时通过在生成消息时调用 mailer 方法指定一个其他的邮件发送驱动:

/**
 * Get the mail representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return \Illuminate\Notifications\Messages\MailMessage
 */
public function toMail($notifiable)
{
    return (new MailMessage)
                ->mailer('postmark')
                ->line('...');
}