I am trying to get a survey form to send result directly to my email. It works sometimes, but I need it to work every time! The problem is that after submission it takes 5-10 minutes to get to my email, and sometimes it doesn't at all! I didn't write the code, I got it from Tutvideos. Can you spot anything in here that would make it work only some of the time?
<title>Thank You!</title><?php
/ Subject and Email Variables /
$emailSubject = 'Survey Results NEW CUSTOMER';
$webMaster = 'jamesduysen@hotmail.com';
/ Gathering Data Variables /
$nombre = $_POST['nombre'];
$gender = $_POST['gender'];
$dog = $_POST['dog'];
$cat = $_POST['cat'];
$other = $_POST['other'];
$explain = $_POST['explain'];
$where = $_POST['where'];
$explain2 = $_POST['explain2'];
$satisfaction = $_POST['satisfaction'];
$products = $_POST['products'];
$explain3 = $_POST['explain3'];
$natural = $_POST['natural'];
$explain4 = $_POST['explain4'];
$natural2 = $_POST['natural2'];
$allpaws = $_POST['allpaws'];
$how = $_POST['how'];
$body = <<<EOD
<br><hr><br>
Name: $nombre <br>
Gender: $gender <br>
What type of animal: $dog, $cat, $other <br>
Explain Other: $explain <br>
Where you buy food: $where <br>
Explain Other: $explain2 <br>
How Satisfied: $satisfaction <br>
What products: $products <br>
Explain: $explain3 <br>
Purchased natural: $natural <br>
Explain: $explain4 <br>
Heard of natural: $natural2 <br>
Heard of All Paws: $allpaws <br>
How: $how <br>
EOD;
$headers = "From: $nombre\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);
/ Results rendered as html /
$theResults = <<<EOD
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<div align="center">Thank you for your submission!</div>
</body>
</html>
EOD;
echo "$theResults";
?>
Thank you so much!
-jD