Natcon67
09-20-2005, 12:16 AM
Hello all,
I am having a problem with calling a method in a class.
The error i am getting is "Call to a member function on a non-object".
and it referrs to the second line in the included notification.php.
The method in the class exists and here is the code:
require('../../mail/class.phpmailer.php');
$result = mysql_query("SELECT * FROM logins WHERE email = '".$_POST['email']."'") or die(mysql_error());
if (($result) && (mysql_num_rows($result) == 1) && ($row = mysql_fetch_array($result))) {
$message = new phpMailer();
$message->From = "webmaster@mydomain.com";
$message->FromName = "Some From Name";
$message->isSMTP();
$message->Host = "mail.mydomain.com";
$message->Username = "webmaster@mydomain.com";
$message->Password = "1234";
$message->Subject = "Account Information";
$message->AddAddress($row['email']);
$message->IsHTML(true);
include("notification.php");
$bodyText = $row['name']."
<br><br>
Thank you for your request for your password.
<br>
Your password is: <font color=\"red\"><b>".$row['password']."</b></font>
<br>
Have a great day,
<br><br>
The staff
<br><br>
";
$message->Body = generateHTML($bodyText);
if(!$message->send())
print "Problem with sending the message";
}
and this is the notification.php page it includes
<?php
$message->AddEmbeddedImage('images/notification_01.jpg', 'notification_01', 'images/notification_01.jpg ');
$message->AddEmbeddedImage('images/notification_02.jpg', 'notification_02', 'images/notification_02.jpg ');
$message->AddEmbeddedImage('images/notification_03.jpg', 'notification_03', 'images/notification_03.jpg ');
$message->AddEmbeddedImage('images/notification_04.jpg', 'notification_04', 'images/notification_04.jpg ');
$message->AddEmbeddedImage('images/notification_06.jpg', 'notification_06', 'images/notification_06.jpg ');
$message->AddEmbeddedImage('images/notification_07.jpg', 'notification_07', 'images/notification_07.jpg ');
$message->AddEmbeddedImage('images/notification_08.jpg', 'notification_08', 'images/notification_08.jpg ');
$message->AddEmbeddedImage('images/notification_09.jpg', 'notification_09', 'images/notification_09.jpg ');
$message->AddEmbeddedImage('images/notification_10.jpg', 'notification_10', 'images/notification_10.jpg ');
$message->AddEmbeddedImage('images/notification_11.jpg', 'notification_11', 'images/notification_11.jpg ');
$message->AddEmbeddedImage('images/notification_12.jpg', 'notification_12', 'images/notification_12.jpg ');
$message->AddEmbeddedImage('images/notification_13.jpg', 'notification_13', 'images/notification_13.jpg ');
$message->AddEmbeddedImage('images/notification_14.jpg', 'notification_14', 'images/notification_14.jpg ');
$message->AddEmbeddedImage('images/notification_15.jpg', 'notification_15', 'images/notification_15.jpg ');
$message->AddEmbeddedImage('images/notification_16.jpg', 'notification_16', 'images/notification_16.jpg ');
$message->AddEmbeddedImage('images/notification_17.jpg', 'notification_17', 'images/notification_17.jpg ');
$message->AddEmbeddedImage('images/spacer.gif', 'spacer', 'images/spacer.gif ');
function generateHTML($text) {
$email = "";
$email .= "
<table id=\"Table_01\" width=\"703\" height=\"575\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td colspan=\"7\">
<img src=\"cid:notification_01\" width=\"703\" height=\"136\" alt=\"\"></td>
</tr>
<tr>
<td>
<img src=\"cid:notification_02\" width=\"120\" height=\"82\" alt=\"\"></td>
<td colspan=\"2\">
<img src=\"cid:notification_03\" width=\"153\" height=\"82\" alt=\"\"></td>
<td>
<img src=\"cid:notification_04\" width=\"74\" height=\"82\" alt=\"\"></td>
<td colspan=\"3\" rowspan=\"3\" bgcolor=\"#FFFFFF\">
".$text."</td>
</tr>
<tr>
<td>
<img src=\"cid:notification_06\" width=\"120\" height=\"115\" alt=\"\"></td>
<td colspan=\"2\">
<img src=\"cid:notification_07\" width=\"153\" height=\"115\" alt=\"\"></td>
<td>
<img src=\"cid:notification_08\" width=\"74\" height=\"115\" alt=\"\"></td>
</tr>
<tr>
<td>
<img src=\"cid:notification_09\" width=\"120\" height=\"64\" alt=\"\"></td>
<td colspan=\"2\">
<img src=\"cid:notification_10\" width=\"153\" height=\"64\" alt=\"\"></td>
<td>
<img src=\"cid:notification_11\" width=\"74\" height=\"64\" alt=\"\"></td>
</tr>
<tr>
<td colspan=\"2\" rowspan=\"3\">
<img src=\"cid:notification_12\" width=\"241\" height=\"177\" alt=\"\"></td>
<td colspan=\"4\">
<img src=\"cid:notification_13\" width=\"294\" height=\"92\" alt=\"\"></td>
<td rowspan=\"3\">
<img src=\"cid:notification_14\" width=\"168\" height=\"177\" alt=\"\"></td>
</tr>
<tr>
<td colspan=\"3\">
<img src=\"cid:notification_15\" width=\"147\" height=\"44\" alt=\"\"></td>
<td rowspan=\"2\">
<img src=\"cid:notification_16\" width=\"147\" height=\"85\" alt=\"\"></td>
</tr>
<tr>
<td colspan=\"3\">
<img src=\"cid:notification_17\" width=\"147\" height=\"41\" alt=\"\"></td>
</tr>
<tr>
<td>
<img src=\"cid:spacer\" width=\"120\" height=\"1\" alt=\"\"></td>
<td>
<img src=\"cid:spacer\" width=\"121\" height=\"1\" alt=\"\"></td>
<td>
<img src=\"cid:spacer\" width=\"32\" height=\"1\" alt=\"\"></td>
<td>
<img src=\"cid:spacer\" width=\"74\" height=\"1\" alt=\"\"></td>
<td>
<img src=\"cid:spacer\" width=\"41\" height=\"1\" alt=\"\"></td>
<td>
<img src=\"cid:spacer\" width=\"147\" height=\"1\" alt=\"\"></td>
<td>
<img src=\"cid:spacer\" width=\"168\" height=\"1\" alt=\"\"></td>
</tr>
</table>";
return $email;
}
?>
any help would be appreciated,
thanks
I am having a problem with calling a method in a class.
The error i am getting is "Call to a member function on a non-object".
and it referrs to the second line in the included notification.php.
The method in the class exists and here is the code:
require('../../mail/class.phpmailer.php');
$result = mysql_query("SELECT * FROM logins WHERE email = '".$_POST['email']."'") or die(mysql_error());
if (($result) && (mysql_num_rows($result) == 1) && ($row = mysql_fetch_array($result))) {
$message = new phpMailer();
$message->From = "webmaster@mydomain.com";
$message->FromName = "Some From Name";
$message->isSMTP();
$message->Host = "mail.mydomain.com";
$message->Username = "webmaster@mydomain.com";
$message->Password = "1234";
$message->Subject = "Account Information";
$message->AddAddress($row['email']);
$message->IsHTML(true);
include("notification.php");
$bodyText = $row['name']."
<br><br>
Thank you for your request for your password.
<br>
Your password is: <font color=\"red\"><b>".$row['password']."</b></font>
<br>
Have a great day,
<br><br>
The staff
<br><br>
";
$message->Body = generateHTML($bodyText);
if(!$message->send())
print "Problem with sending the message";
}
and this is the notification.php page it includes
<?php
$message->AddEmbeddedImage('images/notification_01.jpg', 'notification_01', 'images/notification_01.jpg ');
$message->AddEmbeddedImage('images/notification_02.jpg', 'notification_02', 'images/notification_02.jpg ');
$message->AddEmbeddedImage('images/notification_03.jpg', 'notification_03', 'images/notification_03.jpg ');
$message->AddEmbeddedImage('images/notification_04.jpg', 'notification_04', 'images/notification_04.jpg ');
$message->AddEmbeddedImage('images/notification_06.jpg', 'notification_06', 'images/notification_06.jpg ');
$message->AddEmbeddedImage('images/notification_07.jpg', 'notification_07', 'images/notification_07.jpg ');
$message->AddEmbeddedImage('images/notification_08.jpg', 'notification_08', 'images/notification_08.jpg ');
$message->AddEmbeddedImage('images/notification_09.jpg', 'notification_09', 'images/notification_09.jpg ');
$message->AddEmbeddedImage('images/notification_10.jpg', 'notification_10', 'images/notification_10.jpg ');
$message->AddEmbeddedImage('images/notification_11.jpg', 'notification_11', 'images/notification_11.jpg ');
$message->AddEmbeddedImage('images/notification_12.jpg', 'notification_12', 'images/notification_12.jpg ');
$message->AddEmbeddedImage('images/notification_13.jpg', 'notification_13', 'images/notification_13.jpg ');
$message->AddEmbeddedImage('images/notification_14.jpg', 'notification_14', 'images/notification_14.jpg ');
$message->AddEmbeddedImage('images/notification_15.jpg', 'notification_15', 'images/notification_15.jpg ');
$message->AddEmbeddedImage('images/notification_16.jpg', 'notification_16', 'images/notification_16.jpg ');
$message->AddEmbeddedImage('images/notification_17.jpg', 'notification_17', 'images/notification_17.jpg ');
$message->AddEmbeddedImage('images/spacer.gif', 'spacer', 'images/spacer.gif ');
function generateHTML($text) {
$email = "";
$email .= "
<table id=\"Table_01\" width=\"703\" height=\"575\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td colspan=\"7\">
<img src=\"cid:notification_01\" width=\"703\" height=\"136\" alt=\"\"></td>
</tr>
<tr>
<td>
<img src=\"cid:notification_02\" width=\"120\" height=\"82\" alt=\"\"></td>
<td colspan=\"2\">
<img src=\"cid:notification_03\" width=\"153\" height=\"82\" alt=\"\"></td>
<td>
<img src=\"cid:notification_04\" width=\"74\" height=\"82\" alt=\"\"></td>
<td colspan=\"3\" rowspan=\"3\" bgcolor=\"#FFFFFF\">
".$text."</td>
</tr>
<tr>
<td>
<img src=\"cid:notification_06\" width=\"120\" height=\"115\" alt=\"\"></td>
<td colspan=\"2\">
<img src=\"cid:notification_07\" width=\"153\" height=\"115\" alt=\"\"></td>
<td>
<img src=\"cid:notification_08\" width=\"74\" height=\"115\" alt=\"\"></td>
</tr>
<tr>
<td>
<img src=\"cid:notification_09\" width=\"120\" height=\"64\" alt=\"\"></td>
<td colspan=\"2\">
<img src=\"cid:notification_10\" width=\"153\" height=\"64\" alt=\"\"></td>
<td>
<img src=\"cid:notification_11\" width=\"74\" height=\"64\" alt=\"\"></td>
</tr>
<tr>
<td colspan=\"2\" rowspan=\"3\">
<img src=\"cid:notification_12\" width=\"241\" height=\"177\" alt=\"\"></td>
<td colspan=\"4\">
<img src=\"cid:notification_13\" width=\"294\" height=\"92\" alt=\"\"></td>
<td rowspan=\"3\">
<img src=\"cid:notification_14\" width=\"168\" height=\"177\" alt=\"\"></td>
</tr>
<tr>
<td colspan=\"3\">
<img src=\"cid:notification_15\" width=\"147\" height=\"44\" alt=\"\"></td>
<td rowspan=\"2\">
<img src=\"cid:notification_16\" width=\"147\" height=\"85\" alt=\"\"></td>
</tr>
<tr>
<td colspan=\"3\">
<img src=\"cid:notification_17\" width=\"147\" height=\"41\" alt=\"\"></td>
</tr>
<tr>
<td>
<img src=\"cid:spacer\" width=\"120\" height=\"1\" alt=\"\"></td>
<td>
<img src=\"cid:spacer\" width=\"121\" height=\"1\" alt=\"\"></td>
<td>
<img src=\"cid:spacer\" width=\"32\" height=\"1\" alt=\"\"></td>
<td>
<img src=\"cid:spacer\" width=\"74\" height=\"1\" alt=\"\"></td>
<td>
<img src=\"cid:spacer\" width=\"41\" height=\"1\" alt=\"\"></td>
<td>
<img src=\"cid:spacer\" width=\"147\" height=\"1\" alt=\"\"></td>
<td>
<img src=\"cid:spacer\" width=\"168\" height=\"1\" alt=\"\"></td>
</tr>
</table>";
return $email;
}
?>
any help would be appreciated,
thanks