DasHaas Posted May 25, 2007 Share Posted May 25, 2007 Im trying to send emails to all the email addresses in my database table. My table currently has 3 test emails but the script below only send the email to one of the email addresses. What do I need to modify to make it send to all email addresses in the table? $query = mysql_query("SELECT email FROM PXS_Newsletter WHERE verified = 1") or die (mysql_error()); while($row=mysql_fetch_row($query)) $email = $row[0]; $To = $email; $Subject = $msgsubject; $Body = $msgbody; mail($To, $Subject, $Body); Quote Link to comment Share on other sites More sharing options...
chigley Posted May 25, 2007 Share Posted May 25, 2007 <?php $query = mysql_query("SELECT email FROM PXS_Newsletter WHERE verified = 1") or die (mysql_error()); while($row = mysql_fetch_row($query)) { $email = $row[0]; mail($email, $msgsubject, $msgbody); echo "Email sent to $email<br />"; } ?> Quote Link to comment Share on other sites More sharing options...
DasHaas Posted May 25, 2007 Author Share Posted May 25, 2007 still only sends the email to one recipient. It seems to be sending the email only to the first entry in the database ??? Quote Link to comment Share on other sites More sharing options...
DasHaas Posted May 25, 2007 Author Share Posted May 25, 2007 pfft it worked it just took a few minutes to send to the second email address. DO you think this lag wil be multiplied once I have 100+ email addresses in the database? Quote Link to comment Share on other sites More sharing options...
chigley Posted May 25, 2007 Share Posted May 25, 2007 Sounds like your server needs a cleanup, what are you running on? Quote Link to comment Share on other sites More sharing options...
Guardian-Mage Posted May 25, 2007 Share Posted May 25, 2007 You should look at the PHP Config File My system is similar to yours and sends 100+ emails within 2 minutes Quote Link to comment Share on other sites More sharing options...
DasHaas Posted May 25, 2007 Author Share Posted May 25, 2007 Its not my server, I am using a gate.com server that has PHP and MySql installed. I dont think I have access to the config file Quote Link to comment Share on other sites More sharing options...
chigley Posted May 25, 2007 Share Posted May 25, 2007 I can rattle off about 100 in 30 seconds with almost identical code; so it must be your server! Quote Link to comment Share on other sites More sharing options...
DasHaas Posted May 25, 2007 Author Share Posted May 25, 2007 Maybe I will give them a call and see if they can modify the config file, i dont think they will but its worth a try 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.