I have a form that sends data to the script below. It's supposed to send a message from the person specified in the form's emailaddress. Instead, I get it coming from a strange email address from my hosting company. I've checked the php over and over again and can not find out where the issue is. The email does send... just from the wrong address...
<?
// set recipient email
$mymail = "thelamp.website@yahoo.com";
// get information from form
$name = $_POST['firstname'] . " - " . $_POST['lastinitial'];
$email = $_POST['emailaddress'];
$multiplemail = $mymail . ", " . $email;
$message = $_POST['testimonial'];
$message = wordwrap($message, 200, "\r\n");
$subject = "Testimonial Submission: ";
date_default_timezone_set('US/Eastern');
$body = "Date: " . date('m-d-Y') . " - Time: " . date('h:i:s A e') . "\n Name: " . $name . "\n eMail: <" . $email . "> \n wrote: \n" . $message;
$headers = "To:" . $email . ", " . $mymail . ", From:" . $email;
// check the eMail!
$emailB = filter_var($email, FILTER_SANITIZE_EMAIL);
if (filter_var($emailB, FILTER_VALIDATE_EMAIL) === false || $emailB != $email)
{
// Display error message!
echo "This eMail adress that you entered in the form is invalid! Please go back and enter a correct eMail address!";
// Exit the checking scriptlet!
exit(0);
}
else
{
if(!mail($multiplemail, $subject, $body, $headers))
{
// Testimonial was NOT sent
die ("Testimonial could not be sent! Please try again later!");
}
else
{
// Testimonial was successfully sent
?><meta http-equiv="refresh" content="0; URL=thankyou.html"><?
}
}
?>
Any help you can give me would be greatly appreciated. Thanks in advance.