I want to send multiple emails from php with one unique script.
The emails are from a mysql database table.
How can I achieve this?
The emails are from a mysql database table.
How can I achieve this?
<?php
//connect to database
$query = sprintf("SELECT * FROM mail");
$result = mysql_query($query);
$count = 1;
while ($row = mysql_fetch_assoc($result)) {
$email = $row['Email'];
mail($email, 'My Subject', $message);
if ($count % 5 == 0) {
sleep(5); // this will wait 5 secs every 5 emails sent, and then continue the while loop
}
$count++;
}
?>
Comment