Custom Email Headers in Laravel 4

霸气de小男生 提交于 2019-11-30 13:58:34

As far as I know there's no way to add custom headers without reaching in to Swift Mailer.

Try something like this.

$message->getSwiftMessage()->getHeaders()->addTextHeader('X-Tags', 'tag1 tag2 tag3');

It doesn't look pretty but from looking through the source that should do the trick.


As pointed out in the comments below the getSwiftMessage method isn't required as there is an __call magic method on the Illuminate\Mail\Message class that I overlooked.

$message->getHeaders()->addTextHeader('X-Tags', 'tag1 tag2 tag3');
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!