I need to send a mail header "x-mailgun-native-send: true" to all my mails so they wont get rejected by receivers.
Is it possible to set default mail headers in Laravel? I know I can add headers with every mail by adding this:
$m->getHeaders()->addTextHeader('x-mailgun-native-send', true);
Thanks
I found at Laravel will fire an event right before sending an email: https://laravel.com/docs/5.3/mail#events You can listen for this event and add your headers in the event listeners handle method.
public function handle(MessageSending $event)
{
$headers = $event->message->getHeaders();
$headers->addTextHeader('x-mailgun-native-send', true);
}