Bhavin Shah
Bhavin Shah

Reputation: 2482

Trying to send email to multiple users in Laravel 5.2

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

Answers (2)

istaro
istaro

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

Related Questions