I have a site that is members only.
I have 43 members that have accepted the newsletter. However I want to automatically email the members in a script and I have written a script for this purpose, however I am unfamiliar with the mail() function and it's limitations.
the problem is that i ran a test script and I know how to email using the mail() function. BUT NOW, the script below is not running.
Well it is running, but I ran it 5 minutes ago and it is still loading 🙁
I changed my accounts CONFIRM value to "0" and everyone elses is at "3" so that I can test the script with just my email address.
Can you tell me if this script should work, or am i going to have problems because the $Body is inside the loop? I wanted it inside the loop because their profile_id will be used in the link provided in the email.
<?php
###############################
Confirmation Email Sender
###############################
###################
Include files
###################
include ("../OUTSIDE OF ROOT/tr129.php");
#########################
Connect to Database
#########################
$TableName1 = "profile";
$Link1 = mysql_connect($Host, $User, $Password);
mysql_select_db($DBName, $Link1);
$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/FOLDER/confirm.php?passvar=$Row1[profile_id] \r\n I DO NOT WANT TO CONTINUE MY MEMBERSHIP: http://www.mysite.com/FOLDER/noconfirm.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");
?>