Call to member function on non-object
Posted: Mon Jul 30, 2007 5:10 am
I am getting:
It is checking if the log is enabled - swift has it set to null so I am unsure as to why swift would be trying to make that call? I don't have to use logging do I?
Using php 5.2.2... Swift class is wrapped in my custom class...
my class:
the code:
Code: Select all
Fatal error: Call to a member function isEnabled() on a non-object in .../Swift.php on line 407Using php 5.2.2... Swift class is wrapped in my custom class...
my class:
Code: Select all
require(ADMIN_ROOT . '/includes/swift_mailer/Swift.php');
require(ADMIN_ROOT . '/includes/swift_mailer/Swift/Connection/NativeMail.php');
require(ADMIN_ROOT . '/includes/swift_mailer/Swift/Connection/SMTP.php');
require(ADMIN_ROOT . '/includes/swift_mailer/Swift/Connection/Sendmail.php');
class Mailer extends Swift {
var $mailer;
var $message;
function Mailer() {
global $config;
if ($config['DELIVERY_METHOD'] == 'php')
$conn =& new Swift_Connection_NativeMail();
else if ($config['DELIVERY_METHOD'] == 'sendmail')
$conn =& new Swift_Connection_Sendmail(SWIFT_SENDMAIL_AUTO_DETECT);
else if ($config['DELIVERY_METHOD'] == 'smtp') {
$conn =& new Swift_Connection_SMTP($config['SMTP_HOST'], $config['SMTP_PORT']);
if ($config['SMTP_USER'] != '') {
$conn->setUsername($config['SMTP_USER']);
$conn->setPassword($config['SMTP_PASS']);
}
}
$this->mailer =& new Swift($conn);
$this->message =& new Swift_Message();
if ($config['BOUNCE_METHOD'] != 'none')
$this->message->setReturnPath($config['BOUNCE_EMAIL']);
}
}Code: Select all
$mail =& new Mailer();
$message =& $mail->message;
$message->setSubject($subject);
$message->setFrom(new Swift_Address($fromEmail, $fromName));
$message->setReplyTo(new Swift_Address($fromEmail, $fromName));
$message->setCharset($charSet);
$message->setPriority($priority);
if ($format == 0)
$message->setBody($textContent));
else if ($format == 1) {
$message->setBody($tmp_htmlContent);
$message->setContentType('text/html');
}
else if ($format == 2) {
$message->attach(new Swift_Message_Part($textContent));
$message->attach(new Swift_Message_Part($tmp_htmlContent, 'text/html'));
}
if (!$mail->send($message, $email, new Swift_Address($fromEmail, $fromName))) {
echo 'failed!';
}