I have created a newsletter script for a website I built.
The basic code that does the sending of the emails looks like this
$wait_count = "1";
while ($row = mysql_fetch_array($sql_results_5)) {
$address = $row["EMAIL"];
$address = trim($address);
$mail_send = mail($address,$subject,$message,$headers);
if(!$mail_send) {
errorMsg("Message not sent to $address.");
}
else {
$wait_count++;
$email_count++;
}
if($wait_count == 30) {
sleep(3);
$wait_count = 0;
}
}
It was working fine at first. Now we have about 2000 people signed up for the newsletter and when you run the script, I get a "failure to load page" error in my browser. The script still sends emails to the first 100 or so in the database. So this makes testing a problem, beacuse I don't want to flood those people with emails.
Any idea how to fix this?
Banks