So I have a table in a database called tblUsers for example, where there is a column called 'email'. Basically I want a script that will do a query loop and send the email to all of them (not all at once so that the To: field only has them in it and can personalise the email with Hi, [Name]).
However, there are about 900 rows and my hosts limit is 400/hr. So I'd want a code that does the first 400, and then later I can press a button and it will send rows 401-800... then a third button 801-1200 etc. Of course a script that does this automatically would be better, but not quite sure if that's possible.
Can anyone help me ?
(By the way, it is solicited, they know they signed up to get emails).
I'm open to all suggestions!
--------
So far I've tried this but it doesn't work:
However, there are about 900 rows and my hosts limit is 400/hr. So I'd want a code that does the first 400, and then later I can press a button and it will send rows 401-800... then a third button 801-1200 etc. Of course a script that does this automatically would be better, but not quite sure if that's possible.
Can anyone help me ?
(By the way, it is solicited, they know they signed up to get emails).
I'm open to all suggestions!
--------
So far I've tried this but it doesn't work:
PHP:
<?php
$server = "localhost";
$dbname = "###";
$dbuser = "###";
$dbpass = "###";
$conn = mysql_connect($server,$dbuser,$dbpass) or die ("PHP/MYSQL ERROR: Cannot connect to TJW' database. Please contact the webmaster.");
mysql_select_db($dbname);
$uresult = mysql_query("SELECT * FROM `tblFanbase` LIMIT 100");
while($row = mysql_fetch_array($uresult) {
$to = $row['email'];
$headers = 'From: Tomjwilliams.com <[email protected]>' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$subject = "Tom Williams Update: 27th November 2008"
$message = "Hey.... message goes here"
mail($to, $subject, $message, $headers);
}
?>