I have constructed a Script that basically looks at the MySQL database and pulls out members that have not confirmed their membership. This Script will eventually be integrated and ran automatically with a CronTab job, but I am just testing this right now.
The problem is that my script should work, however I have never used the Mail() function before (except to test my knowledge of it). When I run the Script, it starts to load but the Script takes a LONG time and fails to execute.
I am thinking that there are too many emails to sort through for the script (there are 52 records). But I am not sure if my script has inadvertently come across an infinite loop or if I need to try something else.
Can Anyone tell me what I am doing wrong here?
// connection to DB and other code already performed //
$Query1 = "SELECT* from $TableName1 where confirm = '0'";
$Result1 = mysql_query($Query1, $Link1);
########################################################
Loop through Addresses and send Confirmation Email
########################################################
while ($Row1 = mysql_query($Query1, $Link1)) {
$body = "You have recieved this email to confirm whether or not you wish to continue your Membership.\r\n You MUST click on one of the links below or your membership will be considered INACTIVE and you will LOSE your website and forum access.\r\n I WISH TO CONTNUE MY MEMBERSHIP http://www.mysite.com/ACCESS/confirm.php?passvar=$Row1[profile_id] \r\n I DO NOT WANT TO CONTINUE MY MEMBERSHIP: http://www.mysite.com/ACCESS/confirm.php?passvar=$Row1[profile_id]\r\n Thank You for your cooperation!";
mail("$Row1[email]","Confirmation Email",$body);
}
if (mysql_db_query ($DBName, $Query1, $Link1)) {
print ("Sucessful DB connection!!<br><br>");
}
else {
print (mysql_error());
}
print ("The Confirmation Email should have been sent now");
?>