Хорошо согласно вашему запросу -
Если вы хотите отправлять электронные письма в пакете
Согласно последней документации на http://swiftmailer.org/docs/sending.html
Отправка электронных писем в пакете¶
Если вы хотите отправить отдельное сообщение каждому получателю, чтобы в поле «Кому» отображался только его собственный адрес, следуйте следующему рецепту:
require_once 'lib/swift_required.php';
//Create the Transport
$transport = Swift_SmtpTransport::newInstance('localhost', 25);
//Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
//Create a message
$message = Swift_Message::newInstance('Wonderful Subject')
->setFrom(array('john@doe.com' => 'John Doe'))
->setBody('Here is the message itself')
;
//Send the message
$failedRecipients = array();
$numSent = 0;
$to = array('receiver@domain.org', 'other@domain.org' => 'A name');
foreach ($to as $address => $name)
{
$message->setTo(array($address => $name));
$numSent += $this->send($message, $failedRecipients);
}
printf("Sent %d messages\n", $numSent);
Использование batchSend () - в чем я не уверен, доступен ли он в требуемой версии или нет?
$mailer_instance = Swift_Mailer::newInstance($mail_transport_instance);
$message_instance = Swift_Message::newInstance()
->setSubject($subject)
//Set the From address with an associative array
->setFrom($mail_from)
//Set the To addresses with an associative array
->setTo($mail_to);
//some other options as required
$num_sent = $mailer_instance->batchSend($message_instance);
Надеюсь, это поможет.