Dynamic Batch
Posted: Mon Jan 26, 2009 5:33 am
I want to send a batch to multiple users. So far, I got this:
Some how, the $recipients is not filled, but I don't really know why...
Code: Select all
echo "Email sent";
$swift =& new Swift(new Swift_Connection_SMTP("smtp.host.tld"));
$message =& new Swift_Message($title, $contents, "text/html");
$recipients =& new Swift_RecipientList();
while ($row_customers = mysql_fetch_array($res_customers))
{
$recipients->addTo($row_customers['emailadress']);
}
// just to check:
echo "Sent to: ".$recipients;
//NOTE that Cc and Bcc recipients are IGNORED in a batch send
$swift->batchSend($message, $recipients, "me@somedomain.com");