2
有人知道如何爲通過Laravel Notification System發送的電子郵件添加標題?向Laravel 5.4通知系統發送的電子郵件添加標題
我不是在談論Mailable類,我可以通過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');
}
}
在此先感謝!
謝謝,事件監聽器看起來像添加標題並繼續使用簡單通知的最簡單方法 – chifliiiii