0

i need help with a php contact form script.the problem is when i run it i don`t receive emails when i use contact form.i was in the hope someone can tell me where the problem is located find code below. i run it in test php and got this message. i appreciate if anyone can help

    <php




/* Email Variables */
$emailSubject = 'indie music!'; 
$webMaster = 'myemail';



/* Data Variables */
$email = $_POST['email'];
$name = $_POST['name'];
$comments = $_POST['comments'];



$body = <<<EOD
<br><hr><br>
Name: $name <br>
Email: $email <br>
Comments: $comments <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body,
$headers);



$theResults = <<<EOD
<html>
<head>
<title>sent message</title>
<meta http-equiv="refresh" content="3;URL=mydomain">
<style type="text/css">
<!--
body {
background-color: #444; 
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 20px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #fec001;
text-decoration: none;
padding-top: 200px;
margin-left: 150px;
width: 800px;
}
-->
</style>
</head>
<div align="center"> message has been successfully sent you will be contacted shortly</div>
</div>
</body>
</html>
EOD;
echo "$theResults";
?>
samson
  • 1
  • 1

1 Answers1

0

Did you change $webMaster to a valid recipient email address?

Make sure you're running those script in web hosting. Localhost doesn't execute PHP mail function.

If you're already running on web hosting, make sure mail doesn't go into spam/junk email.

Nikko
  • 385
  • 1
  • 4
  • 14
  • hi everyone yes the webmaster has a valid email.i am running the script on a web hosting.when i use form i get this message your message has been successfully sent we will contact you shortly but i get no emal . i also tested the script on a php script testing site and got this
    Parse error: syntax error, unexpected '<' on line 1
    – samson Mar 05 '15 at 17:04
  • well, I didn't notice your line 1 ` – Nikko Mar 10 '15 at 02:17