Sending email to multiple cc recipients in Laravel 5.4

I have a function that sends an email as follows:

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

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

+4
source share
2 answers

The setAdress () function in Mailable allows you to specify an array as an argument:

Mailable.php

So you should be able to use this function by passing an array as an argument

Mail::to($email)
    ->cc(['name1@domain.com','name2@domain.com'])
    ->send(new document());
+6
source

That should work. From the official Laravel documentation:

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

Source: https://habr.com/ru/post/1676263/


All Articles