我正在尝试将一封电子邮件发送到多封电子邮件,因此我对我的用户表进行了查询,但结果是一个带有不起作用的键的数组mail->to()
。
我需要一个这样的数组:$owners = ['myoneemail@esomething.com', 'myother@esomething.com','myother2@esomething.com'];
来自数据库。
我的查询:
$owners = DB::table('users')->select('email')->where('active', 1)->where('userType', 1)->get();
我也尝试使用->toArray()
,但带有钥匙。
电子邮件:
Mail::send('email-view', $data, function($message) use ($data, $owners)
{
$message->from('no-reply@email.pt' , 'FROM');
$message->to($owners)->subject('subject');
});