I would like to send emails from my DATABASE. I have a few like 100. I have a simple script that sends emails from my DATABASE. I also have a simple DATABASE. I want to CONNECT to my DB then send 5 emails from the DB, then i want my script to SLEEP for 5 seconds. Finally i want to DELETE the emails sent and have a confirmation email SENT to my account. I need to make this script work together in harmony. I WOULD LIKE TO HAVE THIS SCRIPT WORK, but if you guys think its best to use CRON JOB then tell me how DONT SEND ME OFF TO ANOTHER SITE, IF THATS THE CASE then help me with this script first. THANK YOU
This is want i have thus far:
[php]<?php
//connect to database
$query = sprintf(“SELECT * FROM newsletter WHERE received=‘0’ LIMIT 20”);
$numRows = mysql_num_rows($sql); // Added “End Campaign”
$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);
}
$count++;
}
?>