error message when trying using this code
Posted: Sun Dec 23, 2007 3:06 pm
Dear
whn I use this code I get the following error message
what do I need to correct in my script to correct this
the error message that I get is this one :
Notice: Undefined property: Swift::$log in D:\workspace\indiana\gallery\batch.php on line 5
Fatal error: Call to a member function enable() on a non-object in D:\workspace\indiana\gallery\batch.php on line 5
thanks for your help
whn I use this code I get the following error message
what do I need to correct in my script to correct this
Code: Select all
<?php
require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
$swift =& new Swift(new Swift_Connection_SMTP("smtp.myhost"));
$swift->log->enable();
$from = new Swift_Address ('myemail@gmail.com', 'webmaster ');
$subj = 'nieuwsbrief';
$body = 'my body ';
$msg = new Swift_Message ($subj, $body, 'text/html');
require_once('init.php');
$recipients = new Swift_RecipientList();
$sql = "
SELECT naam, email
FROM testmail
ORDER BY naam ASC
";
if (!$res = mysql_query ($sql)) {
trigger_error (mysql_error ());
}
else {
while ($row = mysql_fetch_assoc ($res)) {
$recipient = new Swift_Address ($row['email'], $row['naam']);
$recipients->addTo ($recipient);
}
// en verzenden maar die hap
$num_sent = $swift->send($msg, $recipients, $from);
//$errors = $swift->getFailedRecipients();
echo "Message sent to $num_sent of 2 recipients";
echo "Failed recipients:<br />";
echo implode(" ,", $swift->log->getFailedRecipients());
}
?>Notice: Undefined property: Swift::$log in D:\workspace\indiana\gallery\batch.php on line 5
Fatal error: Call to a member function enable() on a non-object in D:\workspace\indiana\gallery\batch.php on line 5
thanks for your help