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); Link to comment https://forums.phpfreaks.com/topic/52981-mysql-php-mail-problem/ 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 />"; } ?> Link to comment https://forums.phpfreaks.com/topic/52981-mysql-php-mail-problem/#findComment-261688 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 ??? Link to comment https://forums.phpfreaks.com/topic/52981-mysql-php-mail-problem/#findComment-261722 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? Link to comment https://forums.phpfreaks.com/topic/52981-mysql-php-mail-problem/#findComment-261724 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? Link to comment https://forums.phpfreaks.com/topic/52981-mysql-php-mail-problem/#findComment-261727 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 Link to comment https://forums.phpfreaks.com/topic/52981-mysql-php-mail-problem/#findComment-261729 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 Link to comment https://forums.phpfreaks.com/topic/52981-mysql-php-mail-problem/#findComment-261736 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! Link to comment https://forums.phpfreaks.com/topic/52981-mysql-php-mail-problem/#findComment-261737 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 Link to comment https://forums.phpfreaks.com/topic/52981-mysql-php-mail-problem/#findComment-261743 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.