阅读(2632) (0)

Laravel 8 自定义发送者

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

默认情况下,电子邮件的发件人 / 发件人地址 定义在 config/mail.php 配置文件中。 但是,你可以使用 from 方法指定特定通知的发件人地址:

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