javascript - Sending Email via PHP Not Working -


i have site running on windows azure contains simple contact form people in touch. unfortunately, form isn't work right now...

i have index.php file contains form:

<div class="form">name="name" placeholder="name" id="contactname" />     <input type="text" name="email" placeholder="email" id="contactemail" />     <textarea name="message" placeholder="message" id="contactmessage"></textarea>     <button>contact</button> </div> 

i have js file this:

if ($('#contact').is(":visible")) { $("#contact button").click(function() {      var name     = $("#contactname").val();     var message  = $("#contactmessage").val();     var email    = $("#contactemail").val();     var emailreg = /^[a-za-z0-9._+-]+@[a-za-z0-9-]+\.[a-za-z]{2,4}(\.[a-za-z]{2,3})?(\.[a-za-z]{2,3})?$/;      // client-side validation     if(emailreg.test(email) == false) {         var emailvalidation = false;         $('#contactemail').addclass("error");     }     else         $('#contactemail').removeclass("error");      if(name.length < 1) {         var namevalidation = false;         $('#contactname').addclass("error");     }     else         $('#contactname').removeclass("error");      if(message.length < 1) {         var messagevalidation = false;         $('#contactmessage').addclass("error");     }     else         $('#contactmessage').removeclass("error");      if ((namevalidation == false) || (emailvalidation == false) || (messagevalidation == false))         return false;      $.ajax({         type: "post",         datatype: "json",         url: "send-email.php",         data: $("#contact").serialize(),         success: function(data) {              $('.form').html('<p class="success">thanks getting in touch - we\'ll shortly.</p>');          }     });     return false; });  }; 

and finally, php file send email called send-email.php:

$destination = 'info@clouddock.co'; // change email.  // ################################################## // don't edit below unless know you're doing // ##################################################  $email   = $_post['email']; $name    = $_post['name']; $message = $_post['message']; $subject = $name; $headers = "from: ".$name." <".$email.">\r\n" .          "reply-to: ".$name." <".$email.">\r\n" .          "x-mailer: php/" . phpversion() . "\r\n" .          "mime-version: 1.0\r\n" .          "content-type: text/plain; charset=\"iso-8859-1\r\n" .          "content-transfer-encoding: 8bit\r\n\r\n";  mail($destination, $subject, $message, $headers);  } 

when fill in contact form, js validation appears working, , when click send 'thanks getting in touch...' text appears, if message has been sent. don't receive email. can advise problem might be? azures configuration blocking messages being sent out?

you using $("#contact").serialize() data send you've got no elements id contact. should use $("#contactname, #contactemail, #contactmessage").serialize() (and fix first input ;) ).

and validate input data in php, not in js!


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -