Reputation: 2482
I want to send email to multiple users. Here is my email sending code.
$email_id = User::select('email_id')->get();
Mail::send('test' , array('user' => $email_id) , function ($message) {
$message -> to('[email protected]') -> subject ('Welcome!!!');
});
I am getting array of email_id while printing $email_id
and I pass $email_id
to array. but it's not working.
Any help would be grateful.
Thank You.
Upvotes: 0
Views: 257
Reputation: 139
Try this:
$email_id = User::select('email_id')->get()->toArray();
Mail::send('test' , array('user' => $email_id) , function ($message) {
$message -> to('[email protected]') -> subject ('Welcome!!!');
});
Upvotes: 0
Reputation: 257
Please check mention url you can use this
Laravel Mail::send() sending to multiple to or bcc addresses
https://codedump.io/share/7tL5qbeUwnKT/1/laravel-mailsend-sending-to-multiple-to-or-bcc-addresses
Upvotes: 1