Php coding help please?

  • Thread starter Thread starter cybercop
  • Start date Start date
C

cybercop

Guest
Could anyone tell me please where i've made a mistake here in this php coding? When i fill the form in and hit the submit button it does show the $theResults but email doesn't get sent to my address. I've been trying to find out where the problem is but i'm not getting anywhere. I have contacted my server and they support mail().
<?php
$subject = "test";
$to = "[email protected]";
$nameField = $_POST['name'];
$emailField = $_POST['email'];
$inquiryField = $_POST['inquiry'];

$body = <<<EOD
<br><hr><br>
Name: $nameField <br>
Email: $emailField <br>
Inquiry: $inquiryField <br>
EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";


/* Results rendered in Html */

$theResults = "email has been sent";
mail($to,$subject,$body,$headers);
echo "$theResults";

?>
 
It looks like you are doing everything correctly in your PHP script. If you are sure about the TO address and you are not finding the email in your inbox at that address, then first check your spam filter. If the spam filter was not the culprit, then the best thing to do is to check the mail server logs on the server. These should show you if there was a problem when the sending mail server used by PHP went to hook up with your inbound mail server to deliver the message, or if the message was received successfully. If there was a problem the logs will show you what it was. If the logs show that the message was delivered successfully and its not in your inbox and its not in your spam filter, then you need to forward the log record to your mail server admin who should be able to track down the missing message. Hope this helps.
 
Back
Top