I have a simple Contact form hosted in godaddy.com.
Could somebody let me know how I can get rid of that extra code?
I have attached the message received and the PHP code.
Thank you,
-QuiQue
Message received in my Inbox is as follow:
-----Original Message-----
From: noreply@secureserver.net [mailto:noreply@secureserver.net]
Sent: Friday, November 20, 2015 4:16 PM
To: info@xyz.com
Subject: Email from your website
0r
X-Mailer: PHP/5.3.6
X-CMAE-Envelope:
MS4wfNqtxtfJO5WToL/sM9XCtMRJbUXecYqqJFGpCnpN4QmZHDZVyKit8UY0+LTsWA1PyDSy7u5o
VNg4yCpWSrk44Cg4MOwVaWhJXV2YY7Z7QjzC+KF3jjUK
kAilrPxWdhLsQ27p0EGt/Y2ocX8WM7VDfMCN2vwQHt5CfSffh2clM5eOehLvOJTS642NLALPe+Em
24ptW1eJt3IRWM3cKu8aLgQAPqdb+AoUjHh5Auzcw+z+[/B][/B]
============================
The php code I have is as follow:
<?php
if(isset($_POST['email'])){
// Here is the email to information
$email_to ="info@xyz.com"; //your email address goes here
$email_subject = "Email from your website";
$email_from = "Your Website";
//mail ($to, $subject, $comments, "From " . $name );
// error code
function died($error){
echo "Your Message has been sent";
echo "We are sorry, but there were error(s) found with the form you submitted";
echo "These errors appear below.<br/><br/>";
echo $error."<br/><br/>";
echo "Please go back and fix these errors.<br/>";
die();
}
// Validation
if(!isset($_POST['name']) ||
!isset($_POST['email']) ||
!isset($_POST['comments'])){
died('We are sorry, but there appers to be a problem with the form you submitted.');
}
$name = $_POST['name']; // required
$email_from = $_POST['email']; // required
$comments = $_POST['comments']; // required
$error_message = "";
// $email_exp = '/[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}$/';
$email_exp = '/[\s]@[a-z0-9.-]/i';
if(!preg_match($email_exp, $email_from)) {
$error_message .= 'The email address you entered does not appear to be valid.<br/>';
}
$string_exp = "/^[A-Za-z .'-]+$/";
if (!preg_match($string_exp, $name)) {
$error_message .= 'The Name you entered does not appear to be valid.<br/>';
}
if(strlen($comments) < 2) {
$error_message .= 'The Comments you entered does not appear to be valid.<br/>';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form Details below.\n\n";
// Sanitization (to avoid delete the Database, eventhough we are not using it)
function clean_string($string) {
$bad = array("content-type","bcc","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Name:" . clean_string($name). "\n";
$email_message .= "Email:" . clean_string($email). "\n";
$email_message .= "Comments:" . clean_string($comments). "\n";
// Create email headers
$headers = 'From: ' .$email_from . "\r\n".
'Reply-To: '.$email-from. "r\n".
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
<!-- Sucess html Message Goes Here -->
<body style="font-family:Arial, Helvetica, sans-serif; font-size:1em; text-align:center;">
Thank you for contacting me. I will be in touch with you shortly. <br/>
Please click <a href="contact.html">here</a> to go back to my Contact page.
</body>
<?php
}
?>
==================