prgrm
prgrm

Reputation: 3835

Sending email to multiple cc recipients in Laravel 5.4

I have a function that sends an email like this:

Mail::to($email)
->cc($arraywithemails)
->send(new document());

How do I send the email to multiple cc users? I have checked the official documentation but there is no clue there.

Upvotes: 27

Views: 53560

Answers (2)

Mathieu Ferre
Mathieu Ferre

Reputation: 4422

The setAdress() function in Mailable allow you to give an array as argument:

Mailable.php

So You should be able to use the function by passing an array as your argument

Mail::to($email)
    ->cc(['[email protected]','[email protected]'])
    ->send(new document());

Upvotes: 54

Mozammil
Mozammil

Reputation: 8750

That should work. From the offical Laravel documentation:

Mail::to($request->user())
    ->cc($moreUsers)
    ->bcc($evenMoreUsers)
    ->send(new OrderShipped($order));

Upvotes: 12

Related Questions