You can use an “array” :
$to = array(
"user1@gmail.com" => "User 1",
"user2@gmail.com" => "User 2"
);
Example :
$subject = "User";
$to = array(
"user1@gmail.com" => "User 1",
"user2@gmail.com" => "User 2"
);
$from = "contact@become-developer.com";
$name = "Become Developer";
$body = "content";
$message = \Swift_Message::newInstance()
->setSubject($subject)
->setFrom($from)
->setTo($to)
->setBody($body)
/*
* If you also want to include a plaintext version of the message
->addPart(
$this->renderView(
'Emails/registration.txt.twig',
array('name' => $name)
),
'text/plain'
)
*/
;
// or, you can also fetch the mailer service this way
// $this->get('mailer')->send($message);
return $this->mailer->send($message);