You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.
Any ideas about ways to resolve such problem and save standart swiftmailers methods work?
Maybe it can be made with some flags which will say to laravel core when to make call_user_func before or after addContent call ? ==========================================================================
Laravel Version: 5.8.17
PHP Version: 7.3.5
Description:
After update laravel version from 5.5 to 5.8 when using swiftmailer raw method, mail sending starts to give error quoted_printable_encode() expects parameter 1 to be string, array given
If you provide some raw string data as first parameter - mail will be sent, BUT callback function will not make any changes to body with setBody method...
Steps To Reproduce:
Try to send e-mail with raw method using swiftmailer:
`Mail::raw([], function ($message)
{
$message->to('some@email.test');
$message->from('from@my.mail', 'MyName');
$message->subject('Test email send');
$message->setBody('Some cute html body to send', 'text/html');
});`
How To Solve Problem:
In new versions of laravel 5.6+ had been moved call of call_user_func in /vendor/laravel/framework/src/Illuminate/Mail/Mailer.php in send($view, array $data = [], $callback = null) method...
If you move call_user_func back as in previous laravel versions - problem will be solved and all will start work well.
Thats it...
The text was updated successfully, but these errors were encountered:
In our case, we use the $this->withSwiftMessage(...) to modify the message body and add some attachments to the email. (we replace some cid references with urls and embed missing cid references files).
Our code is like
$this->withSwiftMessage(function (Swift_Message $message) {
$body = $message->getBody();
// Modify body, embed some files (searching for images with `src="cid:*` and replace with another cid and embed the file)
$message->setBody($body);
}
This used to work on 5.5, and now we are migrating to latest version, but after 5.6 the callback order rearrange causes this issue.
I understand the reason of the rearrange, but I think that $this->withSwiftMessage() should be able to place a callback BEFORE and AFTER. Maybe, it can receive an optional parameter for placing it before.
Can @taylorotwell give a look here? I think this is an important issue.
Update: Workaround for interested people:
As workaround, I solved this issue with pointers, since my body was a property of my Mailable class:
public function build()
{
$body = &$this->body;
$this->withSwiftMessage(function (Swift_Message $message) use (&$body) {
// now I can modify the $body here, attach my files without problem
}
return $this->view('my.view.template')->with(compact('body'));
}
Made a copy of this one issue.
PR #22995 to fix #22982 cause this problem...
Any ideas about ways to resolve such problem and save standart swiftmailers methods work?
Maybe it can be made with some flags which will say to laravel core when to make call_user_func before or after addContent call ?
==========================================================================
Description:
After update laravel version from 5.5 to 5.8 when using swiftmailer raw method, mail sending starts to give error quoted_printable_encode() expects parameter 1 to be string, array given
If you provide some raw string data as first parameter - mail will be sent, BUT callback function will not make any changes to body with setBody method...
Steps To Reproduce:
Try to send e-mail with raw method using swiftmailer:
`Mail::raw([], function ($message)
{
$message->to('some@email.test');
$message->from('from@my.mail', 'MyName');
$message->subject('Test email send');
$message->setBody('Some cute html body to send', 'text/html');
});`
How To Solve Problem:
In new versions of laravel 5.6+ had been moved call of call_user_func in /vendor/laravel/framework/src/Illuminate/Mail/Mailer.php in send($view, array $data = [], $callback = null) method...
If you move call_user_func back as in previous laravel versions - problem will be solved and all will start work well.
Thats it...
The text was updated successfully, but these errors were encountered: