title: jQuery/PHP mail send the easy way?
body: <p>Ok, to make long story short:</p>
  
  <p>JavaScript:</p>
  
  <pre><code>jQuery("submit").click(function() { 
  
      var address = jQuery("#mail").val();
      var title = jQuery("#title").val(); 
      var name = jQuery("#name").val(); 
      var mail = jQuery("#email").val();  
      var message = jQuery("#msg").val(); 
  
      alert(address);
      alert(title); 
      alert(name); 
      alert(mail); 
      alert(message); 
  
      jQuery.post("sendmail.php",
      {address: address, title: title, name: name, mail: mail , message: message}, 
      function(data){
          jQuery("#email").html("&lt;div id='sent'&gt;&lt;p&gt;Thank you for the message.&lt;/p&gt;&lt;p&gt;We will reply as soon as possible.&lt;/p&gt;&lt;/div&gt;");
          alert('sent');
      });      
  
  return false;       
  });  
  </code></pre>
  
  <p>Works smoothly (shows every value in alert), but never shows div "sent". And never sends an actual mail.</p>
  
  <p>sendmail.php is in the right place, and it's code is:</p>
  
  <pre><code>&lt;?php
  
  // getting variables from form
  
  $emailTo = trim($_REQUEST['address']);
  $subject = trim($_REQUEST['title']);;
  $name = trim($_REQUEST['name']);
  $emailFrom = trim($_REQUEST['mail']);
  $message = $_REQUEST['message'];
  
  // prepare email body text
  
  $Body = "You have a message from: ";
  $Body .= $name;
  $Body .= "\n";
  $Body .= "\n";
  $Body .= $message;
  
  // send prepared message
  
  $sent = mail($emailTo, $subject, $Body);
  
  //callback for jQuery AJAX
  
  if ($sent){
    echo 'sent';
  }
  else{}
  
  print_r($_REQUEST); die();
  ?&gt;
  </code></pre>
  
  <p>Updated jQuery code, also doesn't work:</p>
  
  <pre><code>jQuery("#contact-form-send").click(function() {    
  
      var address = jQuery("#contact-form-mail-address").val();
      var title = jQuery("#contact-form-mail-title").val(); 
      var name = jQuery("#contact-form-name").val(); 
      var mail = jQuery("#contact-form-email").val();  
      var message = jQuery("#contact-form-message").val(); 
  
      var data = "&amp;address=" + address + "&amp;title=" + title + "&amp;name=" + name + "&amp;mail=" + mail + "&amp;message=" + message;
  
      jQuery.ajax({
       type: "POST",
       url: "sendmail.php",
       data: data,
       success: function(){
            jQuery(".email-us").html("&lt;div id='email-sent'&gt;&lt;p&gt;Thank you for the message.&lt;/p&gt;&lt;p&gt;We will reply as soon as possible.&lt;/p&gt;&lt;/div&gt;");     
       }
  });   
  
  return false;       
  });  
  </code></pre>