title: Mail function sends nothing
body: <p>The following codes are responsible of sending mails using Mail() function. The problem that I'm facing is when an email is received, there is nothing (in other words no data is shown in the email). I tested all the functions and they are working properly. </p>
  
  <pre><code>&lt;style&gt;
  #ajax_form {width:410px;font-family:verdana,arial;font-size:12px}
  #ajax_form td{font-family:verdana,arial;font-size:12px}
  #ajax_form_header {font-family:verdana,arial;font-size:1.3em;font-weight:bold;text-align:center}
  #returned_value{font-family:verdana,arial;text-align:center;font-size:12px;color:#000000}
  #go {border:1px solid #CCCCCC;background:#FFF}
  &lt;/style&gt;
  &lt;script type="text/javascript" src="cform.js"&gt;&lt;/script&gt;
  
  &lt;div id="ajax_form"&gt;
  &lt;form&gt;
  &lt;div id="ajax_form_header"&gt;Contact Us Form&lt;/div&gt;
  &lt;br /&gt;
  &lt;table width="350" border="0" align="center" cellpadding="4" cellspacing="0"&gt;
    &lt;tr&gt; 
      &lt;td&gt;&lt;label&gt;Your Name:&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" id="name" style="width:100%" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt; 
      &lt;td&gt;&lt;label&gt;Your Email:&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" id="email" style="width:100%" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt; 
      &lt;td&gt;&lt;label&gt;Your Subject:&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" id="subject" style="width:100%" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt; 
      &lt;td colspan="2"&gt;
          &lt;label&gt;Your Message:&lt;/label&gt;&lt;br /&gt;&lt;br /&gt;
          &lt;textarea name="body" style="width:100%;height:160px" id="body"&gt;&lt;/textarea&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr align="center"&gt; 
      &lt;td colspan="2"&gt;&lt;input type="button" value="Submit" id="submit" onClick="return check_values();"&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
    &lt;br /&gt;
    &lt;div align="center"&gt;&lt;!-- leave this link please --&gt;&lt;a href="http://www.freecontactform.com/ajax_form.php"&gt;Ajax Contact Form&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;
      &lt;div id="confirmation" style="display:none" align="center"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>cform.js code:</p>
  
  <pre><code>var http = createRequestObject();
  var areal = Math.random() + "";
  var real = areal.substring(2,6);
  
  function createRequestObject() {
      var xmlhttp;
      try { xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); }
    catch(e) {
      try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
      catch(f) { xmlhttp=null; }
    }
    if(!xmlhttp&amp;&amp;typeof XMLHttpRequest!="undefined") {
      xmlhttp=new XMLHttpRequest();
    }
      return  xmlhttp;
  }
  
  function sendRequest() {
      var rnd = Math.random();
      var name = escape(document.getElementById("name").value);
      var email = escape(document.getElementById("email").value);
      var subject = escape(document.getElementById("subject").value);
      var body = escape(document.getElementById("body").value);
  
      try{
      http.open('POST',  'pform.php');
      http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
      http.onreadystatechange = handleResponse;
          http.send('name='+name+'&amp;email='+email+'&amp;subject='+subject+'&amp;body='+body+'&amp;rnd='+rnd);
      }
      catch(e){}
      finally{}
  }
  
  function check_values() {
      var valid = '';
  
      var name = document.getElementById("name").value;
      var email = document.getElementById("email").value;
      var subject = document.getElementById("subject").value;
      var body = document.getElementById("body").value;
      if(trim(name) == "" ||
          trim(email) == "" ||
          trim(subject) == "" ||
          trim(body) == "") {
              alert("Please complete all fields");
      } else {
          if(isEmail(email)) {
              document.getElementById("submit").disabled=true;
              document.getElementById("submit").value='Please Wait..';
              sendRequest();
          } else {
              alert("Email appears to be invalid\nPlease check and try again");
              document.getElementById("email").focus();
              document.getElementById("email").select();
          }
      }
  }
  
  function handleResponse() {
      try{
      if((http.readyState == 4)&amp;&amp;(http.status == 200)){
          var response = http.responseText;
        document.getElementById("confirmation").innerHTML = response;
        document.getElementById("confirmation").style.display ="";
          }
    }
      catch(e){}
      finally{}
  }
  
  function isUndefined(a) {
     return typeof a == 'undefined';
  }
  
  function trim(a) {
      return a.replace(/^s*(S*(s+S+)*)s*$/, "$1");
  }
  
  function isEmail(a) {
     return (a.indexOf(".") &gt; 0) &amp;&amp; (a.indexOf("@") &gt; 0);
  }
  </code></pre>
  
  <p>pform.php file:</p>
  
  <pre><code>include 'cform_config.php';
  
  if(!isset($rnd) || !isset($name) || !isset($email) || !isset($subject) || !isset($body)) {
      echo $error_message;
      die();
  }
  
      $email_from = $email;
      $email_subject = "Contact Form: ".stripslashes($subject);
      $email_message = "Please find below a message submitted by '".stripslashes($name);
      $email_message .="' on ".date("d/m/Y")." at ".date("H:i")."\n\n";
      $email_message .= stripslashes($body);
  
      $headers = 'From: '.$email_from."\r\n" .
     'Reply-To: '.$email_from."\r\n" .
     'X-Mailer: PHP/' . phpversion();
  
      mail($email_it_to, $email_subject, $email_message, $headers);
  
      echo "&lt;b&gt;$confirmation&lt;/b&gt;";
      die();
  </code></pre>
  
  <p>cform_config.php file:</p>
  
  <pre><code>  $page_title = "Contact Us Form";
    $email_it_to = "your_own_email_address@some_domain.com";
    $error_message = "Please complete the form first";
    $confirmation = "Thank you, your message has been successfully sent.";
  </code></pre>
  
  <p>I tracked the <code>check_values()</code> function following with <code>sendRequest()</code> function and I found nothing wrong</p>