Someone knows how to add headers to emails sent through Laravel Notification System?
I am not talking about Mailable classes where I can set header through the
Actually I've found 2 ways to append headers.
When the notification is sent via mail channel an Illuminate\Mail\Events\MessageSending
event is fired.
Append a listener to it. In handle()
you will get the Swift_Message
object.
Or in the AppServiceProvider
's register()
method override the MailChannel
with your own and append the header in the send()
method.
$this->app->bind(
\Illuminate\Notifications\Channels\MailChannel::class,
MyMailChannel::class
);