Im trying to send some BCC's through emails gotten from my database.
I made an array out of the emailadresses and names like this:
Code: Select all
$qry = "SELECT N.*, U.* FROM hk_notificaties N, hk_users_DNT U WHERE N.notiID=1 AND N.onoff=1 AND U.userID=N.userID";
$res = mysql_query($qry);
$to=array();
while($r = mysql_fetch_array($res)){
$to[$r['email']]=$r['name'];
}
Code: Select all
require_once('lib/swift_required.php');
$transport = Swift_MailTransport::newInstance();
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance()
->setSubject('xxxx')
->setFrom(array('noreply@xxx.nl' => 'xxx'))
->setTo($to)
->setBody('text!')
->addPart('text', 'text/html');
$result = $mailer->Send($message); */
Code: Select all
Fatal error: Call to a member function getFieldBody() on a non-object in /var/www/vhosts/xxxx.nl/httpdocs/lib/classes/Swift/Transport/MailTransport.php on line 143
Code: Select all
Warning: Invalid argument supplied for foreach() in /var/www/vhosts/xxxx.nl/httpdocs/lib/classes/Swift/Mailer.php on line 143
Thanks in advance