有人知道如何在通过 Laravel通知系统发送的电子邮件中添加标题吗?
我不是在谈论可邮寄类,我可以通过withSwiftMessage()
方法设置标题!
我也想保持使用MailMessage
,一旦我使用line
、greetings
方法构建了大量的电子邮件!
有人有任何线索吗?
以下是我的代码,以防需要查看任何内容!
<?php
namespace PumpMyLead\Notifications\Tenants\Auth;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
class AccountActivation extends Notification
{
use Queueable;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->subject('My email subject')
->greeting('Just a greeting')
->line('Line 1')
->line('Line 2')
->action('CTA wanted', 'http://www.pumpmylead.com')
->line('Byebye');
}
}
提前感谢您!