NealeWeb Posted January 9, 2012 Share Posted January 9, 2012 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); ?> Quote Link to comment Share on other sites More sharing options...
spiderwell Posted January 10, 2012 Share Posted January 10, 2012 you need to post the relevant code from class.phpmailer.php as the code you posted doesnt show the email sending function Quote Link to comment Share on other sites More sharing options...
nealec Posted January 10, 2012 Share Posted January 10, 2012 you need to post the relevant code from class.phpmailer.php as the code you posted doesnt show the email sending function This is the phpmailer.php file 17302_.php Quote Link to comment Share on other sites More sharing options...
Jeffro Posted January 10, 2012 Share Posted January 10, 2012 $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 { //convert database rows to variables mail('$email', '$subject', '$message', null,'-finfo@yourdomain.info'); } Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted January 10, 2012 Share Posted January 10, 2012 How many e-mail addresses are we talking about? If there are a lot, you may want to check with your host. They may be blocking activity of scripts which sends out too much mail. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.