Contact Form Won't Send Email

I’m having some trouble getting my contact form to send an email. It redirects to the “thanks.html” page, however I do not receive an email. Can anyone help with this?

Here is my php

This first bit sets the email address that you want the form to be submitted to.
You will need to change this value to a valid email address that you can access.
$webmaster_email = "[email protected]";

This bit sets the URLs of the supporting pages.
If you change the names of any of the pages, you will need to change the values here.
$feedback_page = “contact.html”;
$error_page = “error_message.html”;
$thankyou_page = “thanks.html”;

This next bit loads the form field data into variables.
If you add a form field, you will need to add it here.
$contact_name = $_REQUEST[‘contact_name’] ;
$company_name = $_REQUEST[‘company_name’] ;
$phone = $_REQUEST[‘phone’] ;
$email = $_REQUEST[‘email’] ;
$website = $_REQUEST[‘website’] ;
$type_of_product = $_REQUEST[‘type_of_product’] ;
$number_of_skus = $_REQUEST[‘number_of_skus’] ;
$orders_per_month = $_REQUEST[‘orders_per_month’] ;
$units_per_order = $_REQUEST[‘units_per_order’] ;
$storage_details = $_REQUEST[‘storage_details’] ;
$ship_method = $_REQUEST[‘ship_method’] ;
$intl_ship_details = $_REQUEST[‘intl_ship_details’] ;
$inv_rec_details = $_REQUEST[‘inv_rec_details’] ;
$returned_inv_details = $_REQUEST[‘returned_inv_details’] ;
$pack_details = $_REQUEST[‘pack_details’] ;
$backorder_noninv_details = $_REQUEST[‘backorder_noninv_details’] ;
$order_integration_details = $_REQUEST[‘order_integration_details’] ;

The following function checks for email injection.
Specifically, it checks for carriage returns - typically used by spammers to inject a CC list.
function isInjected($str) {
$injections = array(’(\n+)’,
$inject = join(’|’, $injections);
$inject = “/$inject/i”;
if(preg_match($inject,$str)) {
return true;
else {
return false;

// If the user tries to access this script directly, redirect them to the feedback form,
if (!isset($_REQUEST[‘email’])) {
header( “Location: $feedback_page” );

// If the form fields are empty, redirect to the error page.
elseif (empty($email) || empty($contact_name)) {
header( “Location: $error_page” );

// If email injection is detected, redirect to the error page.
elseif ( isInjected($email) ) {
header( “Location: $error_page” );

// If we passed all previous tests, send the email then redirect to the thank you page.
else {
mail( “$webmaster_email”, “Request for Quote”,
$contact_name, $company_name, $phone, $email, $website, $type_of_product, $number_of_skus, $orders_per_month,
$units_per_order, $storage_details, $ship_method, $intl_ship_details, $inv_rec_details, $returned_inv_details,
$pack_details, $backorder_noninv_details, $order_integration_details, “From: $email” );
header( “Location: $thankyou_page” );

The mail() does not take that many parameters. You need to build up a string value for what you want the body of the email to be with all your variables. Check out to understand how to use the mail().

Sponsor our Newsletter | Privacy Policy | Terms of Service