Need an extra set of eyes -- Can't figure out why PHP Script won't send email

All, I've been messing with this script all day...and for the life of me I can't figure out why it won't send.   It will process without errors, but there is no notice or anything on this script.   It just gives me a blank screen.  Perhaps another set of eyes on this script will help.   Any help with this woud be greatly appreciated.

Thank you in advance
<?php
if(isset($_POST['email'])) {
	
   // EDIT THE 2 LINES BELOW AS REQUIRED
    $email_to = "myemail@myemailserver.com";
    $email_subject = "Test Email Form";
	$email_from_test = "test@test.com";
     
     
    function died($error) {
        // your error code can go here
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";
        die();
    }
     
    // validation expected data exists
    if(!isset($_POST['Requester_Name']) ||
	isset($_POST['Requested_Insured']) ||
	isset($_POST['Insured_Entity_Name']) ||
	isset($_POST['Requester_Email']) ||
	isset($_POST['Requester_Phone_Number']) ||
	isset($_POST['General_Liability_Certificate']) ||
	isset($_POST['Workers_Comp_Certificate']) ||
	isset($_POST['Automobile_Certificate']) ||
	isset($_POST['Other_Certificate']) ||
	isset($_POST['Certificate_Holder_Name']) ||
	isset($_POST['Certificate_Holder_Address1']) ||
	isset($_POST['Certificate_Holder_Address2']) ||
	isset($_POST['Certificate_Holder_City']) ||
	isset($_POST['Certificate_Holder_State']) ||
	isset($_POST['Certificate_Holder_Zip']) ||
	isset($_POST['Certificate_Holder_Specific_Project']) ||
	isset($_POST['Additional_Insureds']) ||
	isset($_POST['Additional_Loss_Payee']) ||
	isset($_POST['Waiver_Of_Subrogation']) ||
	isset($_POST['WOS_For_GL1']) ||
	isset($_POST['WOS_For_GL']) ||
	isset($_POST['Same_As_Cert_Holder']) ||
	isset($_POST['Additional_Insured_Instructions']) ||
	isset($_POST['Special_Certificate_Instructions']) ||
	isset($_POST['Send_Certificate_Via']) ||
	isset($_POST['Send_Certificate_Via_Address'])) {

        died('We are sorry, but there appears to be a problem with the form you submitted.');       
    }
     
	$Requester_Name = $_POST['Requester_Name']; // required
	$Requested_Insured = $_POST['Requested_Insured']; // required
	$Insured_Entity_Name = $_POST['Insured_Entity_Name']; // required
	$Requester_Email = $_POST['Requester_Email']; // required
	$Requester_Phone_Number = $_POST['Requester_Phone_Number']; // required
	$General_Liability_Certificate = $_POST['General_Liability_Certificate']; // required
	$Workers_Comp_Certificate = $_POST['Workers_Comp_Certificate']; // required
	$Automobile_Certificate = $_POST['Automobile_Certificate']; // required
	$Other_Certificate = $_POST['Other_Certificate']; // required
	$Certificate_Holder_Name = $_POST['Certificate_Holder_Name']; // required
	$Certificate_Holder_Address1 = $_POST['Certificate_Holder_Address1']; // required
	$Certificate_Holder_Address2 = $_POST['Certificate_Holder_Address2']; // required
	$Certificate_Holder_City = $_POST['Certificate_Holder_City']; // required
	$Certificate_Holder_State = $_POST['Certificate_Holder_State']; // required
	$Certificate_Holder_Zip = $_POST['Certificate_Holder_Zip']; // required
	$Certificate_Holder_Specific_Project = $_POST['Certificate_Holder_Specific_Project']; // required
	$Additional_Insureds = $_POST['Additional_Insureds']; // required
	$Additional_Loss_Payee = $_POST['Additional_Loss_Payee']; // required
	$Waiver_Of_Subrogation = $_POST['Waiver_Of_Subrogation']; // required
	$WOS_For_GL1 = $_POST['WOS_For_GL1']; // required
	$WOS_For_GL = $_POST['WOS_For_GL']; // required
	$Same_As_Cert_Holder = $_POST['Same_As_Cert_Holder']; // required
	$Additional_Insured_Instructions = $_POST['Additional_Insured_Instructions']; // required
	$Special_Certificate_Instructions = $_POST['Special_Certificate_Instructions']; // required
	$Send_Certificate_Via = $_POST['Send_Certificate_Via']; // required
	$Send_Certificate_Via_Address = $_POST['Send_Certificate_Via_Address']; // required
	
	$error_message = "";    
	$email_exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$"; 
	if(!eregi($email_exp,$Requester_Email)) 
	{$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
	}
	 $string_exp = "^[a-z .'-]+$";
	if(!eregi($string_exp,$Requester_Name)) {$error_message .= 'The Requester_Name you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Requested_Insured)) {$error_message .= 'The Requested_Insured you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Insured_Entity_Name)) {$error_message .= 'The Insured_Entity_Name you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Requester_Phone_Number)) {$error_message .= 'The Requester_Phone_Number you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$General_Liability_Certificate)) {$error_message .= 'The General_Liability_Certificate you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Workers_Comp_Certificate)) {$error_message .= 'The Workers_Comp_Certificate you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Automobile_Certificate)) {$error_message .= 'The Automobile_Certificate you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Other_Certificate)) {$error_message .= 'The Other_Certificate you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Certificate_Holder_Name)) {$error_message .= 'The Certificate_Holder_Name you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Certificate_Holder_Address1)) {$error_message .= 'The Certificate_Holder_Address1 you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Certificate_Holder_Address2)) {$error_message .= 'The Certificate_Holder_Address2 you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Certificate_Holder_City)) {$error_message .= 'The Certificate_Holder_City you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Certificate_Holder_State)) {$error_message .= 'The Certificate_Holder_State you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Certificate_Holder_Zip)) {$error_message .= 'The Certificate_Holder_Zip you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Certificate_Holder_Specific_Project)) {$error_message .= 'The Certificate_Holder_Specific_Project you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Additional_Insureds)) {$error_message .= 'The Additional_Insureds you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Additional_Loss_Payee)) {$error_message .= 'The Additional_Loss_Payee you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Waiver_Of_Subrogation)) {$error_message .= 'The Waiver_Of_Subrogation you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$WOS_For_GL1)) {$error_message .= 'The WOS_For_GL1 you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$WOS_For_GL)) {$error_message .= 'The WOS_For_GL you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Same_As_Cert_Holder)) {$error_message .= 'The Same_As_Cert_Holder you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Additional_Insured_Instructions)) {$error_message .= 'The Additional_Insured_Instructions you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Special_Certificate_Instructions)) {$error_message .= 'The Special_Certificate_Instructions you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Send_Certificate_Via)) {$error_message .= 'The Send_Certificate_Via you entered does not appear to be valid.<br />';  }
	if(!eregi($string_exp,$Send_Certificate_Via_Address)) {$error_message .= 'The Send_Certificate_Via_Address you entered does not appear to be valid.<br />';  }


    $email_message = "Form details below.\n\n";
     
    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }
     
	$email_message .= "Requester_Name: ".clean_string($Requester_Name)."\n";
	$email_message .= "Requested_Insured: ".clean_string($Requested_Insured)."\n";
	$email_message .= "Insured_Entity_Name: ".clean_string($Insured_Entity_Name)."\n";
	$email_message .= "Requester_Email: ".clean_string($Requester_Email)."\n";
	$email_message .= "Requester_Phone_Number: ".clean_string($Requester_Phone_Number)."\n";
	$email_message .= "General_Liability_Certificate: ".clean_string($General_Liability_Certificate)."\n";
	$email_message .= "Workers_Comp_Certificate: ".clean_string($Workers_Comp_Certificate)."\n";
	$email_message .= "Automobile_Certificate: ".clean_string($Automobile_Certificate)."\n";
	$email_message .= "Other_Certificate: ".clean_string($Other_Certificate)."\n";
	$email_message .= "Certificate_Holder_Name: ".clean_string($Certificate_Holder_Name)."\n";
	$email_message .= "Certificate_Holder_Address1: ".clean_string($Certificate_Holder_Address1)."\n";
	$email_message .= "Certificate_Holder_Address2: ".clean_string($Certificate_Holder_Address2)."\n";
	$email_message .= "Certificate_Holder_City: ".clean_string($Certificate_Holder_City)."\n";
	$email_message .= "Certificate_Holder_State: ".clean_string($Certificate_Holder_State)."\n";
	$email_message .= "Certificate_Holder_Zip: ".clean_string($Certificate_Holder_Zip)."\n";
	$email_message .= "Certificate_Holder_Specific_Project: ".clean_string($Certificate_Holder_Specific_Project)."\n";
	$email_message .= "Additional_Insureds: ".clean_string($Additional_Insureds)."\n";
	$email_message .= "Additional_Loss_Payee: ".clean_string($Additional_Loss_Payee)."\n";
	$email_message .= "Waiver_Of_Subrogation: ".clean_string($Waiver_Of_Subrogation)."\n";
	$email_message .= "WOS_For_GL1: ".clean_string($WOS_For_GL1)."\n";
	$email_message .= "WOS_For_GL: ".clean_string($WOS_For_GL)."\n";
	$email_message .= "Same_As_Cert_Holder: ".clean_string($Same_As_Cert_Holder)."\n";
	$email_message .= "Additional_Insured_Instructions: ".clean_string($Additional_Insured_Instructions)."\n";
	$email_message .= "Special_Certificate_Instructions: ".clean_string($Special_Certificate_Instructions)."\n";
	$email_message .= "Send_Certificate_Via: ".clean_string($Send_Certificate_Via)."\n";
	$email_message .= "Send_Certificate_Via_Address: ".clean_string($Send_Certificate_Via_Address)."\n";

     
     
// create email headers
$headers = 'From: '.$email_from_test."\r\n".
'Reply-To: '.$email_from_test."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);  
?>
 
<!-- include your own success html here -->
 
Thank you for contacting us. We will be in touch with you very soon.
 
<?php
}
?>

Open in new window

LVL 1
Earl KellyAsked:
Who is Participating?
 
Dave BaldwinFixer of ProblemsCommented:
You might need a '!' in front of the rest of the 'isset' statements in your 'validation' routine.  Right now, it looks like it bombs out if any but one of them 'isset' instead of not set.  Add the code below right after the first '<?php' so you can see any errors.

// Report all PHP errors
error_reporting(E_ALL);

Open in new window

0
 
jrm213jrm213Commented:
If it is a live site you don't want the error showing up in, you can just as easily look in your error log.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.