File: /home/vmasmheia229/domains/defml.net/html/send.php
<?php
// Change this to be who you want the contact message sent to, and confirmation message sent from. Will help if it's whatever@defml.net or whatever domain. So it won't be thought of as spam.
$admin='enternetconnections@gmail.com';
if( isset($_POST['submit']) ) {
$phone = $_POST['phone'];
$name = $_POST['name'];
$email=stripslashes($_POST['email']);
$body=stripslashes($_POST['body']);
$messageSubject='Message from ' . $name ;
$confirmationSubject='Confirmation of your email message to Skywalker & Son';
$confirmationBody="Thank you for contacting us. Your case information has been sent and we will be in touch with you soon.\n\n";
$message_contents = "A message was sent from " . $name . ": <br />";
$message_contents .= "<b>Phone</b>: " . $phone . " <br />";
$message_contents .= "<b>Email</b>: " . $email . " <br />";
$message_contents .= "<b>Message</b>: " . $body . " <br />";
$displayForm=true;
// if ($_POST){
// validate e-mail address
$valid=eregi('^([0-9a-z]+[-._+&])*[0-9a-z]+@([-0-9a-z]+[.])+[a-z]{2,6}$',$email);
$crack=eregi("(\r|\n)(to:|from:|cc:|bcc:)",$body);
if ($email && $body && $valid && !$crack){
$confheader = "MIME-Version: 1.0\r\n";
$confheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
$confheader .= "From: Skywalker & Son <".$admin.">\r\n";
$confheader .= "Reply-To:" . $admin. " \r\n";
$confheader .= "Return-Path: " . $admin . "\r\n";
$header = "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html; charset=iso-8859-1\r\n";
$header .= "From: $name <".$email.">\r\n";
$header .= "Reply-To:" . $email. " \r\n";
$header .= "Return-Path: " . $email . "\r\n";
$confSent = mail($email, $confirmationSubject, $confirmationBody, $confheader); // Send confirmation to whoever filled out the form
$emailSent = mail($admin, $messageSubject, $message_contents, $header); // Send form contents to admin email
// if (mail($to,$messageSubject,("Name: ".$name."\nPhone: ".$phone . "\nEmail: ". $email."\n\n". $body),'From: '.$email."\r\n")){
if( isset( $emailSent ) && $emailSent == true ) {
?>
<?php
print ("<p class=\"success\">Thank you for contacting us. Your case information has been sent and we will be in touch with you soon.</p>");
?>
<?php
}else{ // the messages could not be sent
?>
<?php
print ("<p class=\"fail\">Sorry, we're having problems with our server. Please contact us using the phone number above.</p>");
?>
<?php
}
} else if ($crack) { // cracking attempt
?>
<?php print ("<p class=\"fail\">Please enter a valid email address and describe your case.</p>"); ?>
<?php
} else { // form not complete
?>
<?php print ("<p class=\"fail\">Please enter a valid email address and describe your case.</p>"); ?>
<?php
}
//}
} // if form is submitted
?>