问题
I am updating code from laravel 4 to laravel 5
In laravel 4 there is mail functionality implemented with some code like below
Mail::send('emailtemplate.sample', $content_data, function ($message) use ($to_mail, $email_data, $from_name) {
$message->from('admin@domain.com', 'admin')->to($to_mail)->subject($email_data->subject);
$headers = $message->getHeaders();
$headers->addTextHeader('X-MC-PreserveRecipients', 'false');
});
I don't know how to replace $headers = $message->getHeaders();
and $headers->addTextHeader('X-MC-PreserveRecipients', 'false');
in laravel 5 mail functionality
If anyone knows, then please suggest
回答1:
As jszobody mentioned,
The getHeaders()
method is being called on Swift_Message
which isn't part of Laravel, it's a third-party component. So even though Laravel 5 has changed, Swift hasn't and should continue working like before.
来源:https://stackoverflow.com/questions/29098301/add-headers-in-mail-function-laravel-5