I am using this code for an email form processor:
Code:
But for some reason I don't receive the email, even though i get the success message. Am I doing something wrong?
Code:
<?PHP
//security function
function IsInjected($str) {
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)');
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str)) {
return true;
} else {
return false;
}
}
//Get form entries
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$description = $_POST['job-description'];
$contact_method = $_POST['contact-method'];
//security
if(IsInjected($email)) {
echo "Bad email value!";
exit;
}
//Compose email
$email_from = <valid address>;
$email_subject = "TopPage Design form submission: quotes.html";
$email_body = "*** FORM SUBMISSION *** \n
name: " . $name . "\n
email: " . $email . "\n
phone: " . $phone . "\n
description: " . $description . "\n
contact method: " . $contact_method . "\n
*** END OF EMAIL ***";
//Send email
$to = <valid address>;
$headers = "From" . $email_from . "\r\n";
$headers .= "Reply-To:" . $email . "\r\n";
//send
mail($to, $email_subject, $email_body, $headers);
//success
echo("success.");
?>
But for some reason I don't receive the email, even though i get the success message. Am I doing something wrong?