First of all thanks all of you for your time. I have a question, I need to send multiple emails and I have the var
$contact['email'] = $request->get('email');
which returns the emails of the db users with $array['b@a.com','a@a.com']
How can I implement it? (I'm on laravel 5.6 and I'm using App\Mail\ContactEmail
)
public function store(ContactFormRequest $request)
{
$contact = [];
$contact['email'] = $request->get('email');
$contact['msg'] = $request->get('msg');
$contact['name_company'] = $request->get('name_company');
$contact['datoperfil'] = $request->get('datoperfil');
$contact['destinatarios'] = $request->get('destinatarios');
$contact['name'] = $request->get('name');
$contact['cargo'] = $request->get('cargo');
$contact['sendermail'] = $request->get('sendermail');
$contact['fono'] = $request->get('fono');
Mail::send(new ContactEmail($contact))
;
return redirect()->route('avisos')->with('notification','Mensaje enviado!');
}
Thanks a lot
To send a message, use the to
method on the Mail
facade
$arr = ['b@a.com','a@a.com'];
Mail::to($arr)->send(new ContactEmail($contact));