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
Debbie V has a pretty close answer but not quite right. The issue she is referencing makes it clear, but she missed the necessary context that solution provided.
By default a Notification in Laravel uses MailMessage
, however you can also have it return a Mailable
instead. Only if you: a) create a custom mailable, and b) use that instead of MailMessage
will the callbacks be applied.
A more complete solution would be:
php artisan make:mail MyMailable
public function toMail($notifiable)
method to utilize a the new Mailable
.MyMailable
class.And after that you should be all good. The hardest part of this is just adapting the current MailMessage
you use to fit the API of a Mailable
.