problem with contact form send mail function
Posted: Wed Sep 15, 2010 6:26 am
Hi
I have this form, when I want to send mail to myself with all the fields form the form, no matter what I do I can not get it to work. its ok sending reply email to the person tho. Area of problem highlighted in bold.
Please help
Gren
See code:
I have this form, when I want to send mail to myself with all the fields form the form, no matter what I do I can not get it to work. its ok sending reply email to the person tho. Area of problem highlighted in bold.
Please help
Gren
See code:
Code: Select all
// load the variables form address bar
include("my_message.php");
$name = $_POST["name"];
$subject = $_POST["subject"];
$message = $_POST["message"];
$number = $_POST["number"];
$from = $_POST["from"];
$verif_box = $_POST["verif_box"];
// remove the backslashes that normally appears when entering " or '
$name = stripslashes(name);
$message = stripslashes($message);
$subject = stripslashes($subject);
$number= stripslashes ($number);
$from = stripslashes($from);
//auto reply vars
//$replysub="the food galley";
$replymsg="Thanks for contacting the food galley, we will be intouch soon.\n\n the food gallery";
$email="grenambrose@gmail.com";
// check to see if verificaton code was correct
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
// if verification code was correct send the message and show this page
[b] mail("grenambrose@gmail.com", 'Online Form: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$message, "From: $from");[/b]
mail($from, 'the food galley',$mymessage, $headers);
// delete the cookie so it cannot sent again by refreshing this page
setcookie('tntcon','');
} else if(isset($message) and $message!=""){
// if verification code was incorrect then return to contact page and show error
header("Location: index.php?subject=$subject&from=$from&message=$message&wrong_code=true");
exit;
} else {
echo "no variables received, this page cannot be accessed directly";
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>E-Mail Sent</title>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style></head>
<body>
Email sent. Thank you.
</body>
</html>