Not receiving email from PHP mail() contact form -
i know question has been asked countless times have been unable find answer specific me.
my contact form seems validating fine , when suitable data entered , "send message" button clicked, message displayed saying message has in fact been sent. there no error messages on screen.
my html code looks this:
<form action="send.php" id="contact_form" method="post" name="contact_form"> <ul> <li> <label>name <span class="required">*</span></label> <input type="text" name="name" id="name" value="" class="requiredfield" /> </li> <li> <label>email <span class="required">*</span></label> <input type="text" name="email" id="email" value="" class="requiredfield email" /> </li> <li class="textarea"> <label>message <span class="required">*</span></label> <textarea name="message" id="message" rows="20" cols="30" class="requiredfield"></textarea> </li> <li class="button_form"> <input name="submitted" id="submitted" value="send message" class="submit" type="submit" /> <input id="reset" type="reset" value="reset form" class="submit" /> </li> </ul> </form> <script type="text/javascript"> //<![cdata[ $(document).ready(function(){ $("#form").validate(); }); //]]>
my js looks this:
$(document).ready(function() { $('form#contact_form').submit(function() { $('form#contact_form .error').remove(); var haserror = false; $('.requiredfield').each(function() { if(jquery.trim($(this).val()) == '') { var labeltext = $(this).prev('label').text(); $(this).parent().append('<span class="error">please enter '+labeltext+'</span>'); $(this).addclass('inputerror'); haserror = true; } else if($(this).hasclass('email')) { var emailreg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; if(!emailreg.test(jquery.trim($(this).val()))) { var labeltext = $(this).prev('label').text(); $(this).parent().append('<span class="error">please valid '+labeltext+'</span>'); $(this).addclass('inputerror'); haserror = true; } } }); if(!haserror) { $('form#contact_form input.submit').fadeout('normal', function() { $(this).parent().append(''); }); var forminput = $(this).serialize(); $.post($(this).attr('action'),forminput, function(data){ $('form#contact_form').slideup("fast", function() { $(this).before('<p class="success">thank you!<br/>your email sent successfully.<br/>i contact possible.</p>'); }); }); } return false; }); });
my php looks this:
<?php error_reporting(e_all ^ e_notice); // hide basic notices php if(!isset($haserror)) { $emailto = 'name@domain.com'; $subject = 'submitted message '.$name; $sendcopy = trim($_post['sendcopy']); $body = "name: $name \n\nemail: $email \n\ncomments: $comments"; $headers = 'from: ' .' <'.$emailto.'>' . "\r\n" . 'reply-to: ' . $email; mail($emailto, $subject, $body, $headers); $emailsent = true; } } ?>
am missing in code? appreciated!
what email system used in server. have sendmail, smtp etc. mean whether checked mail port (ex:smtp_port) , smtp ip address ("localhost or 192.168.132.1 etc") etc in php.ini file.
if there problem these settings mail won't work. best first check smtp faster sendmail. can use google smtp settings purpose. check link https://www.digitalocean.com/community/articles/how-to-use-google-s-smtp-server.
Comments
Post a Comment