How to send multiple letters in laravel5.5

I want to send some letters. I use the code below to send multiple emails: -

$emails = ['ab.in@gmail.com', 'ka.in@gmail.com'];

    Mail::send('emails.email-marketing-template', [], function($message) use ($emails)
    {    
        $message->to($emails)->subject('This is test e-mail');    
    });
    var_dump( Mail:: failures());
    exit;

If I send it to one user, it works, but not for multiple users. How to send an email to multiple users?

+4
source share
2 answers

From 5.5 docs :

to , . , email name , , .

, :

$users = User::get();
Mail::to($users)->send(new OrderShipped($order));

name email:

$users = [
    ['name' => 'John', 'email' => 'john@gmail.com'],
    ['name' => 'Jane', 'email' => 'jane@gmail.com'],
    ['name' => 'Max', 'email' => 'max@gmail.com'],
];
+5

Laravel Symfony /. Laravel.

, , , , .

Mail:queue,

0

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


All Articles