High,
I am collecting data from a form and sending it using the mail() function. I have two sites (same client, same hosting service) that I do this on. The first one works fine but on the second one the mail function is very slow (up to 5 minutes to display the page). When I remove the mail function and just print the message to the browser, it works fine. I have asked the hosting service to look at it and they can find no problems on their end. I'm stumped. Can anyone help? My code is below:
<?
// Get Temp member num
$sql = "select max(membernum) as mnum from members";
$sqlresult = mysql_query($sql) or html_exit(33);
$array = mysql_fetch_array($sqlresult);
$mnum = $array["mnum"];
if (substr("$mnum",0,1) == 'T') {
$mnum ++;
} else {
$mnum ++;
$mnum = "T".$mnum;
}
// Prepare Email
$mName1 = addslashes($mName);
$msg = "Monthly Membership Amount:\t$mCost\n";
$msg .= "Yearly Membership Amount:\t$yCost\n";
$msg .= "Locker Amount:\t$Locker\n";
$msg .= "Locker Shared With:\t$LockerShared\n";
$msg .= "Total:\t$mTotal\n\n";
$msg .= "Application Date:\t$mDate\n";
$msg .= "Applicant's Name:\t$mName\n";
$msg .= "Applicant's Address:\t$mAddress\n";
$msg .= "Applicant's City, St, Zip:\t$mCSZ\n";
$msg .= "Applicant's Daytime Phone:\t$mDayPhone\n";
$msg .= "Applicant's Evening Phone:\t$mEvePhone\n";
$msg .= "Applicant's Email:\t$mEmail\n";
$msg .= "Applicant's Drivers License Number:\t$mDriversLicense\n";
$msg .= "Applicant's Date Of Birth:\t$mDOB\n";
$msg .= "Applicant's Credit Card Number:\t$mccnum\n";
$msg .= "Applicant's Credit Card Expiration Date:\t$mExpDate\n";
$msg .= "Applicant's Credit Card Type:\t$mcctype\n";
$msg .= "Applicant Agrees/Disagrees:\t$mad\n";
$msg .= "Applicant's Temporay Member Number:\t$mnum\n\n";
$msg .= "*****This is a new membership application. Be sure and assign a permanant member number and email it to the applicant.*****";
// Send Email
$mailheaders = "From: New Membership Applicant\n";
$mailheaders .= "Reply-To: $mEmail\n\n";
mail("tccigars@dfwcigars.com", "New Membership Applicant", $msg, $mailheaders) or html_exit(35);
// Insert Member into members table
$sql2 = "insert into members values ('$mnum', '$mName1', 'Y', '')";
$sql2_result = mysql_query($sql2) or html_exit(34);
// Display Message to Applicant
echo "<font face=\"Arial\" size=\"4\">Thank you $mName,<br><br></font>";
echo "<font face=\"Arial\" size=\"4\">Your Membership Application has been Emailed and will be processed soon.</font><br><br>
<font face=\"Arial\" size=\"4\" COLOR=\"Maroon\">Your Temporary Member ID Number Is: $mnum</font><br><br>
<font face=\"Arial\" size=\"2\"><b><i>Please write your temporary ID number down.<br>
You will need it if you want to place an order before you receive your permanent ID number.<br>
You can use your temporary ID number to purchase products and receive your 20% discount.<br>
Simply press the \"View Cart\" button and select the \"Checkout\" button.<br>
Enter your temporary ID number where it asks for your member number.<br><br>
You can continue shopping by pressing one of the link buttons above.<br> </i></b></font>";
?>