dan3460
590
2
Laravel

Serialization of closure is not allowed, in queuing a mail

Posted 10 months ago by dan3460

I have a simple email that sends files to a customer.

    public function storeReceiver(Request $request)
    {
        $files = Document::whereIn('document_id',explode(',',$request->fileList))->get();
        $receiver = Receiver::find($request->receiverID);

        Mail::to($receiver->entity->entity_contact_email)->queue(new SendDocuments($files));
    }

That works fine, but in the request i also have some text that i want to put in the body of the email. So when i do this:

Mail::to($receiver->entity->entity_contact_email)->queue(new SendDocuments($files,$request));

Gives me the error in the title. If i replace queue by send, works fine. So its clearly complaining about the two parameters in the mail object when sent to the queue. Is there any way around this?

Please sign in or create an account to participate in this conversation.