The following IS working when I use Mail::send
$email = 'my@email.com';
$name = 'My Name';
$invoice = InvoicePdf::generate($invoice_id); // generates PDF as raw data
Mail::send('mail.template', null, function($message) use ($name, $email, $invoice) {
$message->to($email, $name);
$message->subject('Thank you for your order!');
$message->attachData($invoicePdf, 'invoice.pdf', ['mime' => 'application/pdf']);
});
It works fine and an email is generated with the correct PDF attachment.
However, if I change Mail::send
to Mail::queue
then I receive the following error:
Unable to JSON encode payload. Error code: 5
/var/www/html/october/vendor/laravel/framework/src/Illuminate/Queue/Queue.php line 90
If I take the $message->attachData();
line out then it works even with Mail::queue
so it seems like the raw data from the attachment is causing issues with the queue but there's nothing in the relevant October or Laravel docs about how to deal with this.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire