I have users database, and I want to send email to all my one form So I am trying like this:
$d=Mail::send('admin.email_template', $data, function ($message) use ($data,$emailIds) {
$message->from('dinesh224401@gmail.com', 'Dinesh Laravel');
$message->to($emailIds)->subject($data['subject']);
});
where $emailIds
have 'dinesh.rkgit@rediffmail.com', 'anu.rkgit@rediffmail.com'
but I am getting this error:
Address in mailbox given ['abc1@rediffmail.com', 'abc@rediffmail.com'] does not comply with RFC 2822, 3.6.2.
if I use directly emails in mail function like this:
$message->to('abc1@rediffmail.com', 'abc@rediffmail.com')
then it works, Updated: I am making this string from array as:
$aa=implode("', '",array('dinesh.rkgit@rediffmail.com', 'anu.rkgit@rediffmail.com'));
//print_r("'".$aa."'");
$emailIds="['".$aa."']"; //I have used [] here but it did not work also
echo $emailIds
//output ['dinesh.rkgit@rediffmail.com', 'anu.rkgit@rediffmail.com']
I do not know what is problem, Thanks in advance.