i've made basic php contact form adapted open source code found, site published, , i'm having issue. mainly, form seems work email not arriving in client's inbox.
i sent test email client using email recipient, , haven't received it. however, when substitute own email comes inbox fine. might worth noting client has aol email address - aol blocks this? i've had them check spam folder, still can't see it.
i've checked code issues, , i'm baffled going on here. i've used similar form adjustments other sites i've made no issues.
the html form:
<form name="contactform" method="post" action="mailer.php" class="form-horizontal" role="form"> <div class="form-group"> <label for="inputname" class="col-lg-2 control-label">name</label> <div class="col-lg-10"> <input type="text" class="form-control" id="inputname" name="inputname" placeholder="your name"> </div> </div> <div class="form-group"> <label for="inputemail1" class="col-lg-2 control-label">email</label> <div class="col-lg-10"> <input type="text" class="form-control" id="inputemail" name="inputemail" placeholder="your email"> </div> </div> <div class="form-group"> <label for="inputphone" class="col-lg-2 control-label">phone</label> <div class="col-lg-10"> <input type="text" class="form-control" id="inputphone" name="inputphone" placeholder="your telephone number"> </div> </div> <div class="form-group"> <label for="inputsubject" class="col-lg-2 control-label">subject</label> <div class="col-lg-10"> <input type="text" class="form-control" id="inputsubject" name="inputsubject" placeholder="message subject"> </div> </div> <div class="form-group"> <label for="inputpassword1" class="col-lg-2 control-label">message</label> <div class="col-lg-10"> <textarea class="form-control" rows="4" id="inputmessage" name="inputmessage" placeholder="your message..."></textarea> </div> </div> <div class="form-group"> <div class="col-lg-offset-2 col-lg-10"> <button type="submit" class="btn btn-default"> send message </button> </div> </div> </form> </div> the php file:
<?php /* set e-mail recipient */ $myemail = "clientsemail@aol.com"; /* check form inputs using check_input function */ $name = check_input($_post['inputname'], "your name"); $email = check_input($_post['inputemail'], "your e-mail address"); $phone = check_input($_post['inputphone'], "your telephone number"); $subject = check_input($_post['inputsubject'], "message subject"); $message = check_input($_post['inputmessage'], "your message"); /* if e-mail not valid show error message */ if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)) { show_error("invalid e-mail address"); } /* let's prepare message e-mail */ $subject = "inquiry website"; $message = " has sent message using website's contact form: name: $name email: $email telephone: $phone subject: $subject message: $message "; /* send message using mail() function */ mail($myemail, $subject, $message); /* redirect visitor thank page */ header('location: http://www.theclientswebsite.com/confirmation.html'); exit(); /* functions used */ function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data) == 0) { show_error($problem); } return $data; } function show_error($myerror) { ?> <html> <body> <p>please correct following error:</p> <strong><?php echo $myerror; ?></strong> <p>hit button , try again</p> </body> </html> <?php exit(); } ?>
Comments
Post a Comment