So, I am running on a a free webhost 3owl.com. I know that free hosts suck compared to paid but its temporary. Anyways, I have 90 users that need email sent to them.
The issue:
I cannot send them at a speed of more than 1 every 4 seconds.
I must not run the while loop for more than 40 seconds at a time.
So, I need help figuring out how to send the email in sections.
Send email 1
4 second break
Send email 2
4 second break
Send email 3
4 second break
Send email 4
4 second break
Send email 5
4 second break
Send email 6
4 second break
Send email 7
4 second break
Send email 8
4 second break
Send email 9
4 second break
Send email 10
---------------
STOP SCRIPT in a way that doesnt load the website? for 10 seconds
---------------
continue with the next 10
Is this even possible? Maybe some sort of checkbox system which list the users and you can check who you wish to email it to...
Here is my current code
mail_users($_POST['subject'], $_POST['content']);
And the function for that looks like this:
function mail_users($subject, $body) {
$query = mysql_query("SELECT `email`, `first_name` FROM `users` WHERE `allow_email` = 1");
while (($row = mysql_fetch_assoc($query)) !== false) {
email($row['email'], $subject, "Hello ". $row['first_name'] . ",\n\n" . $body);
sleep(4);
}
}
I am in great need of help. Maybe some javascript is needed for the checkboxes