javascript - Why does my contact form isn't working? -
i'm trying add website contact form jquery , fancybox.
all seems doing well, pop-up animation ok, mail seems sended i'm not receiving mail :(
could me understand problem ?
edit:
-i've checked junk , spam folder
-here website link: lacouleurdurendezvous.fr
-someone talked server misconfiguration, ?
edit:
-it seems server malfunction... i'm trying conatct web hoster...
here how call scripts:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js" type="text/javascript"></script> <script src="ressources/retour.js"></script> <script src="ressources/testhead.js"></script> <script type="text/javascript" src="fancybox/jquery.fancybox.js?v=2.0.6"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script><script type="text/javascript" src="fancybox/jquery.fancybox.js?v=2.0.6"></script>
here html code:
<li id="menu"><a class="modalbox" href="#inline">contactez nous</a></li> <!-- hidden inline form --> <div id="inline"> <h2>envoyez nous un email</h2> <form id="contact" name="contact" action="#" method="post"> <label for="email">e-mail</label> <input type="email" id="email" name="email" class="txt"> <br> <label for="msg">message</label> <textarea id="msg" name="msg" class="txtarea"></textarea> <button id="send">envoyer</button> </form> </div> <!-- basic fancybox setup --> <script type="text/javascript"> function validateemail(email) { var reg = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-za-z\-0-9]+\.)+[a-za-z]{2,}))$/; return reg.test(email); } $(document).ready(function() { $(".modalbox").fancybox(); $("#contact").submit(function() { return false; }); $("#send").on("click", function(){ var emailval = $("#email").val(); var msgval = $("#msg").val(); var msglen = msgval.length; var mailvalid = validateemail(emailval); if(mailvalid == false) { $("#email").addclass("error"); } else if(mailvalid == true){ $("#email").removeclass("error"); } if(msglen < 4) { $("#msg").addclass("error"); } else if(msglen >= 4){ $("#msg").removeclass("error"); } if(mailvalid == true && msglen >= 4) { // if both validate attempt send e-mail // first hide submit btn user doesnt click twice $("#send").replacewith("<em>en cours d'envoi</em>"); $.ajax({ type: 'post', url: 'sendmessage.php', data: $("#contact").serialize(), success: function(data) { if(data == "true") { $("#contact").fadeout("slow", function(){ $(this).before("<p><strong>merci de votre interet, bonne journee</strong></p>"); settimeout("$.fancybox.close()", 4000); }); } } }); } }); }); </script>
and php:
<?php $sendto = "hello@tiphainebuccino.com"; $usermail = $_post['email']; $content = nl2br($_post['msg']); $subject = "la couleur du rendez vous"; $headers = "from: " . strip_tags($usermail) . "\r\n"; $headers .= "reply-to: ". strip_tags($usermail) . "\r\n"; $headers .= "mime-version: 1.0\r\n"; $headers .= "content-type: text/html;charset=utf-8 \r\n"; $msg = "<html><body style='font-family:arial,sans-serif;'>"; $msg .= "<h2 style='font-weight:bold;border-bottom:1px dotted #ccc;'>new user feedback</h2>\r\n"; $msg .= "<p><strong>sent by:</strong> ".$usermail."</p>\r\n"; $msg .= "<p><strong>message:</strong> ".$content."</p>\r\n"; $msg .= "</body></html>"; if(@mail($sendto, $subject, $msg, $headers)) { echo "true"; } else { echo "false"; } ?>
Comments
Post a Comment