Thanks for the fast reply, Robert, but I can't get it to work. Here is the complete code before and after the edit. Before teh edit, the code sends an email, but after editing there is no email sent anylonger.
ORIGINAL:
if(strtolower($prev_status) == "refund requested" && strtolower($status) == "refund denied"){
//refund denied send denied email
//grab customer data
$temp = @mysql_query("SELECT * FROM purchased_leads WHERE leadID = '{$_REQUEST[leadid]}'");
$cusid = mysql_result($temp, 0, 'recID');
$temp = mysql_query("SELECT email, firstName, lastName FROM user WHERE recid = ({$cusid})");
if(mysql_num_rows($temp)>0){
$customer_email = @mysql_result($temp, 0, 'email');
$customer_first_name = @mysql_result($temp, 0, 'firstName');
$customer_last_name = @mysql_result($temp, 0, 'lastName');
$templatename = "reviewer_deny_refund";
$strings = Array (
'%FIRST_NAME%' => $customer_first_name,
'%LAST_NAME%' => $customer_last_name,
'%LEADID%' => $_REQUEST[leadid],
'%EMAIL_ADDRESS%' => $customer_email,
'%SITE_NAME%' => $label['site_name'],
'%REQUEST_DATETIME%' => date("Y-m-d H:i:s")
);
// Format the e-mail
$email_data = format_email($templatename, $strings);
// Strings to replace in the subject line
$strings = Array (
'%SITE_NAME%' => $label['site_name'],
'%LEADID%' => $_REQUEST[leadid]);
$email_data[subject] = format_subject($email_data[subject], $strings);
//echo "DEBUG: line 63<br>";
// Send the e-mail
if($customer_email !=""){
mail($customer_email, $email_data[subject], $email_data[message], "From: {$email_address[admin]}\r\n");
}
}
}
EDITED:
if(strtolower($prev_status) == "refund requested" && strtolower($status) == "refund denied"){
//refund denied send denied email
//grab customer data
$temp = mysql_query("SELECT purchased_leads.* FROM purchased_leads p JOIN refundNotes r ON p.leadID=r.leadID WHERE p.leadID='{$_REQUEST[leadid]}'");
$cusid = mysql_result($temp, 0, 'recID');
$temp = mysql_query("SELECT email, firstName, lastName FROM user WHERE recid = ({$cusid})");
if(mysql_num_rows($temp)>0){
$customer_email = @mysql_result($temp, 0, 'email');
$customer_first_name = @mysql_result($temp, 0, 'firstName');
$customer_last_name = @mysql_result($temp, 0, 'lastName');
$refund_notes = @mysql_result($temp, 0, 'refundNotes');
$templatename = "reviewer_deny_refund";
$strings = Array (
'%FIRST_NAME%' => $customer_first_name,
'%LAST_NAME%' => $customer_last_name,
'%LEADID%' => $_REQUEST[leadid],
'%EMAIL_ADDRESS%' => $customer_email,
'%REFUND_NOTES%' => $refund_notes,
'%SITE_NAME%' => $label['site_name'],
'%REQUEST_DATETIME%' => date("Y-m-d H:i:s")
);
// Format the e-mail
$email_data = format_email($templatename, $strings);
// Strings to replace in the subject line
$strings = Array (
'%SITE_NAME%' => $label['site_name'],
'%LEADID%' => $_REQUEST[leadid]);
$email_data[subject] = format_subject($email_data[subject], $strings);
// Send the e-mail
if($customer_email !=""){
mail($customer_email, $email_data[subject], $email_data[message], "From: {$email_address[admin]}\r\n");
}
}
}