Jump to content

mail form is not sending


bryanptcs

Recommended Posts

I have a contact form and it used to work.  I think I might have changed versions of php but I am not sure what I had before.  It is now running 5.1.6, here is the php code for the form.  This is the error I am getting, it is from the last line of the PHP code: "Error: Please press back on your browser and try again."

 


<?php


$EmailTo = "[email protected]";



$contactsubject= Trim(stripslashes ($_POST['subject']));
$Name= Trim(stripslashes ($_POST['name']));
$HomeTel= Trim(stripslashes ($_POST['phone']));
$Email= Trim(stripslashes ($_POST['email']));
$Message= Trim(stripslashes ($_POST['message']));
$EmailFrom = $Email;
// validation
$validationOK=true;
if (Trim($Name)=="") $validationOK=false;
if (Trim($contactsubject)=="") $validationOK=false;
if (Trim($Email)=="") $validationOK=false;
if (Trim($Message)=="") $validationOK=false;
if (!$validationOK) {
  echo "The form was not properly sent, please press back on your browser and make sure all required feilds are entered and try again.  Thank you.";
  exit;
}

$Subject = "ChristKidz.com Contact Form " . $contactsubject;


$Body ="";
$Body .="Name: ";
$Body .=$Name;
$Body .="\n";
$Body .="Phone: ";
$Body .=$HomeTel;
$Body .="\n";
$Body .="Email: ";
$Body .=$Email;
$Body .="\n";
$Body .="\n";
$Body .="Message: ";
$Body .="\n";
$Body .=$Message;
$Body .="\n";


$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>", $ReplyTo);


if ($success) {

    echo "The Following Message has succesfully been sent to the childrens ministry:<br><br>";

    echo "Name: $Name<br>";
echo "Phone: $HomeTel<br>";
echo "Email: $Email<br><br>";
echo "Subject: $Subject<br><br>";
echo "Message: $Message<br><br>";
    echo "Thank you for your questions or comments, we will reply to them as soon as possible.  Have a great day";

}
else {

echo "Error: Please press back on your browser and try again.";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/95510-mail-form-is-not-sending/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.