I'm using Laravel 5.3 and trying to send a newsletter Mail to specific mail adresses.
Currently I do the following:
$newsletterMailAdresses = Newsletter::where('user_id', $userID)->pluck('mailAdress');
This returns an array of email-adresses, to which the emails shouuld be sent.
What I then (normally) use to send mails is:
Mail::to("someMailAdress")->send(new newsletterMail($newsletterText));
I thought about just passing that array into the to
function but I'm quite sure it won't work.... What you propably could do, is a foreach with every mail adress and send the mails, but is this the way how this should be done or is there a better way?
PS: I know that thread but its about Laravel 4, so there are many things changed.
I think it should work, when you pass an array. Check the reference:
https://laravel.com/api/5.3/Illuminate/Mail/Message.html#method_to
The first parameter can be an array. Try it.