title: Why doesn't ajax form send it?
body: <p>I am making a ajax form. I get the success message but I dont get any email, any thoughts?</p>
  
  <p>send-form.php:</p>
  
  <pre><code>&lt;?php
  // Email Submit
  // Note: filter_var() requires PHP &gt;= 5.2.0
  if ( isset($_POST['email']) &amp;&amp; isset($_POST['name']) &amp;&amp; isset($_POST['text']) &amp;&amp; isset($_POST['email'])) ) {
  
  
    // detect &amp; prevent header injections
    $test = "/(content-type|bcc:|cc:|to:)/i";
    foreach ( $_POST as $key =&gt; $val ) {
      if ( preg_match( $test, $val ) ) {
        exit;
      }
    }
  
    //send email
    mail( "mymail@email.com", "Contact Form: ".$_POST['name'], $_POST['text'], "From:" . $_POST['email'] );
  
  }
  ?&gt;
  </code></pre>
  
  <p>functions.js:</p>
  
  <pre><code>$(function() {
    // Contact Form
  $("#contact").submit(function(e){
    e.preventDefault();
    var name = $("#name").val();
    var email = $("#email").val();
    var text = $("#text").val();
    var dataString = 'name=' + name + '&amp;email=' + email + '&amp;text=' + text;
    $("#contact").validate({
    submitHandler: function(form) {
  
      $.ajax({
      type: "POST",
      url: "send-form.php",
      data: dataString,
      success: function(){
        $('.success').fadeIn(1000);
      }
      });
    }
   })
    return false;
  });
  
  });
  </code></pre>
  
  <p>index.html:</p>
  
  <pre><code>&lt;form id="contact" method="post"&gt;
    &lt;fieldset&gt;
      &lt;label&gt;Your Name&lt;/label&gt;&lt;br /&gt;
      &lt;input name="name" id="name" type="text"&gt;  
      &lt;label&gt;Your Email&lt;/label&gt;&lt;br /&gt;
      &lt;input name="email" id="email" type="text"&gt;  
      &lt;label&gt;Your Question&lt;/label&gt;&lt;br /&gt;
      &lt;textarea rows="10" name="text" id="text" &gt;&lt;/textarea&gt;
    &lt;/fieldset&gt;
    &lt;input type="submit" value="Send Message" name="submit"&gt;
    &lt;p class="success" style="display:none"&gt;Your message has been sent successfully.&lt;/p&gt;
    &lt;p class="error" style="display:none"&gt;E-mail must be valid and message must be longer than 100 characters.&lt;/p&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I have been siting with this in hours, trying to edit it with my own skill, but no success. This is what I got so far. I am getting the success message but no email sent to me.</p>
  
  <p>Any Help is appreciated!</p>