Nealec
01-09-2012, 08:14 PM
I have no idea what im doing wrong but this just isnt working, theres no error messages but im not getting any of the emails. Here is all the code that i had anything to do with editing, i have removed any personal info from it.
<?php
$dbhost = 'localhost';
$dbuser = ' ';
$dbpass = ' ';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db(" ", $conn);
$result = mysql_query("SELECT ****, ********** FROM **** WHERE name='*****'");
while($row = mysql_fetch_array($result))
{
$message =
"<p><u><b><font size=\"5\" color=\"#800080\">********************</font></b></u></p>
<p><b><font color=\"#800080\" size=\"4\">**************************************************</font></b></p>
<p><b><font color=\"#800080\">*********</font></b> <b><font color=\"#333333\">**********</font></b></p>
<p><b><font color=\"#800080\">********</font></b> <font color=\"#333333\"><b>***********</b></font></p>
<p><font color=\"#800080\"><b>*******</b></font> <font color=\"#333333\"><a href=\"***********************************************</a></font></p>
<p> </p>";
}
$query=mysql_query('SELECT `email`,`name` FROM `users`'); //grab emails and names from database
while($row = mysql_fetch_array($query)) //start a loop to send an email to each individual
{
//mail function with $row['email'] as the email address
//I'm using phpmailer as an example here - - >
include_once('phpMailer/class.phpmailer.php');
$mail = new PHPMailer(); // defaults to using php "mail()"
$body = $message; //message inside the email
$mail->From = "**************"; //email address that the email is being sent from
$mail->FromName = "*************"; //more in depth for who the mail is from.
$mail->Subject = "***********************************"; //The subject for the message
//$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->AddAddress($row[email], $row['name']);
}
mysql_close($conn);
?>
<?php
$dbhost = 'localhost';
$dbuser = ' ';
$dbpass = ' ';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db(" ", $conn);
$result = mysql_query("SELECT ****, ********** FROM **** WHERE name='*****'");
while($row = mysql_fetch_array($result))
{
$message =
"<p><u><b><font size=\"5\" color=\"#800080\">********************</font></b></u></p>
<p><b><font color=\"#800080\" size=\"4\">**************************************************</font></b></p>
<p><b><font color=\"#800080\">*********</font></b> <b><font color=\"#333333\">**********</font></b></p>
<p><b><font color=\"#800080\">********</font></b> <font color=\"#333333\"><b>***********</b></font></p>
<p><font color=\"#800080\"><b>*******</b></font> <font color=\"#333333\"><a href=\"***********************************************</a></font></p>
<p> </p>";
}
$query=mysql_query('SELECT `email`,`name` FROM `users`'); //grab emails and names from database
while($row = mysql_fetch_array($query)) //start a loop to send an email to each individual
{
//mail function with $row['email'] as the email address
//I'm using phpmailer as an example here - - >
include_once('phpMailer/class.phpmailer.php');
$mail = new PHPMailer(); // defaults to using php "mail()"
$body = $message; //message inside the email
$mail->From = "**************"; //email address that the email is being sent from
$mail->FromName = "*************"; //more in depth for who the mail is from.
$mail->Subject = "***********************************"; //The subject for the message
//$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->AddAddress($row[email], $row['name']);
}
mysql_close($conn);
?>