Niyaz
260
7
Laravel

To send multiple PDF attachment in single mail

Posted 9 months ago by Niyaz

Hi previously I have been doing adding single attachment in an email but now i need to do it as multiple Pdf attachments in a single mail

This is my code

$pdf = PDF::loadView('pdf.request', ['request' => $data]);
            $sendData = array(
                'data'  => $data
                );
            $response = Mail::send('emails.appro_email_template', $sendData, function ($message) use ($pdf, $sendData) {
                $message->from($sendData['data']->email, $sendData['data']->name);
                $message->to($sendData['data']->email, $sendData['data']->name);
                $message->subject('form approval');
                $message->attachData($pdf->output(), $sendData['data']->unit_no."_request.pdf");
            });

can anyone tell me do it for multiple attachment Suggest me as i can use for loop or the something else, if so please guide me

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

Reply to

Use Markdown with GitHub-flavored code blocks.