Niyaz

To send multiple PDF attachment in single mail

Posted 5 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.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.