This script is sending me to the correct page once I submit but I dont receive the email and I am not sure why. The script works with my other website.
Anyone have any ideas?
MY FORM:PHP Code:<?php
if(isset($_POST['Email_Address'])) {
if($email_to == "youremailaddress@yourdomain.com") {
die("This message is for the Webmaster. Please enter your email address");
}
function died($error) {
echo "Sorry, but there were error(s) found with the form your submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
if(!isset($_POST['Full_Name']) ||
!isset($_POST['Email_Address']) ||
!isset($_POST['Telephone_Number']) ||
!isset($_POST['Your_Message'])) {
died('We are sorry, but there appears to be a problem with the form your submitted.');
}
$email_to = "myemail@yahoo.com"; // your email address
$email_subject = "Mylubbock Form"; // email subject line
$thankyou = "index.html"; // thank you page
$full_name = $_POST['Full_Name']; // required
$email_from = $_POST['Email_Address']; // required
$telephone = $_POST['Telephone_Number']; // not required
$comments = $_POST['Your_Message']; // required
$error_message = "";
$email_exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$";
if(!eregi($email_exp,$email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
if(strlen($full_name) < 2) {
$error_message .= 'Your Name does not appear to be valid.<br />';
}
if(strlen($comments) < 2) {
$error_message .= 'The Comments you entered do not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\r\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Full Name: ".clean_string($full_name)."\r\n";
$email_message .= "Email: ".clean_string($email_from)."\r\n";
$email_message .= "Telephone: ".clean_string($telephone)."\r\n";
$email_message .= "Message: ".clean_string($comments)."\r\n";
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
header("Location: $thankyou");
?>
<script>location.replace('<?php echo $thankyou;?>')</script>
<?
}
?>
HTML Code:<form id="contactform" action="contact.php" method="post" ><!--id=contactform--> <ol> <li> <label for="Full_Name">First Name <span class="red">*</span></label> <input id="Full_Name" name="Full_Name" class="text" /> </li> <li> <label for="Email_Address">Your email <span class="red">*</span></label> <input id="Email_Address" name="Email_Address" class="text" /> </li> <li> <label for="company">Company</label> <input id="company" name="company" class="text" /> </li> <li> <label for="Telephone_Number">Phone #</label> <input id="Telephone_Number" name="Telephone_Number" class="text" /> </li> <li> <label for="Your_Message">Message <span class="red">*</span></label> <textarea id="Your_Message" name="Your_Message" rows="6" cols="50"></textarea> </li> <input name="submit" type="submit" value="Send" />





Bookmarks