Please help me. I have been trying to get this script to:
1. Scan my MySQL table with 4 email fields
2. Send html message to email 1 at a time (to be be regarded as spam)
3. Loop back to the top when reach the last email and start over every 2 weeks
4. schedule to run at night around 2, 3am.
5. Include one image at the top and a couple at the bottom.
please help. Here's what I have so far.
$headers = 'From:
email@example.com' . "\r\n" .
'Reply-To:
email@example.com' . "\r\n" .
'X-Mailer: php/' . phpversion();
mysql_select_db($database_authenticate, $authenticate);
$result = mysql_query("SELECT email1, email2,email3,email4, FROM users WHERE sub = $sub");
if(mysql_num_rows($result) > 0)
{
$count = 0;
while ($row = mysql_fetch_array ($result, mysql_ASSOC))
{
$to = $row['email1'] . ', ';
$to = $row['email2'] . ', ';
$to = $row['email3'] . ', ';
$to .= $row['email4'];
mail($to, $subject, $message, $headers);
$count++;
}
echo "myResult=$count Emails Sent.";
}
else
{
echo "myResult=Email Submissions Failed.";
}