Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Form processing not sending email
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/11601645/sent-mail-will-going-to-spam-folder">sent mail will going to spam folder?</a> </p> </blockquote> <p>I have a simple html form:</p> <pre><code>&lt;div id="content"&gt; &lt;h2&gt;Contact Us&lt;/h2&gt; &lt;form name="contact" action="form-to-email4.php" method="post"&gt; &lt;label&gt;Name: &lt;/label&gt;&lt;input type="text" name="contact_name" /&gt;&lt;br /&gt; &lt;label&gt;Email Address: &lt;/label&gt;&lt;input type="email" name="contact_email" /&gt;&lt;br /&gt;&lt;br /&gt; &lt;label&gt;Message: &lt;/label&gt;&lt;textarea name="message" rows="10" cols="50"&gt; &lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt; &lt;input type="submit" value="Submit"&gt;&lt;/form&gt;&lt;br /&gt;&lt;br /&gt; &lt;/div&gt; </code></pre> <p>and a PHP script to process and email the information</p> <pre><code>&lt;?php if($_SERVER['REQUEST_METHOD'] !== 'POST') { //This page should not be accessed directly. Need to submit the form. echo "error; you need to submit the form!"; die; } $name = $_POST['contact_name']; $email = $_POST['contact_email']; $message = $_POST['message']; if ($_POST['contact_name'] == "" || $_POST['contact_email'] == "" || $_POST['message'] == "" ) { echo "Please fill in all boxes.";} else { $email_from = 'chris569x@gmail.com';//&lt;== update the email address $email_subject = "Message from the SGU Website"; $email_body = "You have received a new message from the SGU website.\n". "Message From: $name \n". "Email Address: $email \n". "Message: $message \n"; $to = "chris569x@gmail.com";//&lt;== update the email address $headers = "From: $email_from \r\n"; //Send the email! mail($to,$email_subject,$email_body,$headers); //done. redirect to thank-you page. header('Location: thanks4.htm'); echo "&lt;meta http-equiv='refresh' content='0; url=thanks4.htm'&gt;";} ?&gt; </code></pre> <p>The script seems to process correctly. I get the message if i try to access the PHP directly, I get the message if not all required fields are filled in, and I get re-directed to the page at the end of the script, but I never receive any emails. What am I missing? (I am very new to this)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload