Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Batch-Versand von E-Mails mit SwiftMailer

Ich bin mir nicht ganz sicher, ob ich Ihre Frage richtig gestellt habe, aber hier ist eine Möglichkeit, es zu tun:

<?php
$message = Swift_Message::newInstance()
  ->setSubject('Let\'s get together today.')
  ->setFrom(array('[email protected]' => 'From Me'))
  ->setBody('Here is the message itself')
  ->addPart('<b>Test message being sent!!</b>', 'text/html')
;

$data = mysql_query('SELECT first, last, email FROM users WHERE is_active=1') or die(mysql_error());
while($row = mysql_fetch_assoc($data))
{
   $message->addTo($row['email'], $row['first'] . ' ' . $row['last']);
}

$message->batchSend();
?>

Ich hoffe, das wolltest du.