html - PHP Mail form does not send -
this question has answer here:
i copied message form , php mail website. doesn't seem work. not send or make reaction. tried find error, not familiar php. tried editing $emailfrom =... $_post['email']; doesn't work either..
html:
<div id="form-main"> <div id="form-div"> <form class="form" id="form1"> <p class="name"> <input name="name" type="text" class="validate[required,custom[onlyletter],length[0,100]] feedback-input" placeholder="naam"/> </p> <p class="email"> <input name="email" type="text" class="validate[required,custom[email]] feedback-input" placeholder="e-mail" /> </p> <p class="text"> <textarea name="text" class="validate[required,length[6,300]] feedback-input" placeholder="bericht"></textarea> </p> <div class="submit"> <input type="submit" value="verstuur" id="button-blue"/> <div class="ease"></div> </div> </form> </div> </div>
php:
<?php include 'functions.php'; if (!empty($_post)){ $data['success'] = true; $_post = multidimensionalarraymap('cleaneviltags', $_post); $_post = multidimensionalarraymap('cleandata', $_post); //your email adress $emailto ="lisa-ederveen@hotmail.com"; //"yourmail@yoursite.com"; //from email adress $emailfrom =$_post['email']; //"contact@yoursite.com"; //email subject $emailsubject = "mail porta"; $name = $_post["name"]; $email = $_post["email"]; $comment = $_post["comment"]; if($name == "") $data['success'] = false; if (!preg_match("/^[_\.0-9a-za-z-]+@([0-9a-za-z][0-9a-za-z-]+\.)+[a-za-z]{2,6}$/i", $email)) $data['success'] = false; if($comment == "") $data['success'] = false; if($data['success'] == true){ $message = "name: $name<br> email: $email<br> comment: $comment"; $headers = "mime-version: 1.0" . "\r\n"; $headers .= "content-type:text/html; charset=utf-8" . "\r\n"; $headers .= "from: <$emailfrom>" . "\r\n"; mail($emailto, $emailsubject, $message, $headers); $data['success'] = true; echo json_encode($data); } } ?>
your form incomplete, missed method
(post) , action
(your php filename)
try instead:
<div id="form-main"> <div id="form-div"> <form action="sendemail.php" method="post" class="form" id="form1"> <p class="name"> <input name="name" type="text" class="validate[required,custom[onlyletter],length[0,100]] feedback-input" placeholder="naam"/> </p> <p class="email"> <input name="email" type="text" class="validate[required,custom[email]] feedback-input" placeholder="e-mail" /> </p> <p class="text"> <textarea name="comment" class="validate[required,length[6,300]] feedback-input" placeholder="bericht"></textarea> </p> <div class="submit"> <input type="submit" value="verstuur" id="button-blue"/> <div class="ease"></div> </div> </form> </div> </div>
sendemail.php
<?php //include 'functions.php'; if (!empty($_post)){ $data['success'] = true; //$_post = multidimensionalarraymap('cleaneviltags', $_post); //$_post = multidimensionalarraymap('cleandata', $_post); //your email adress $emailto ="lisa-ederveen@hotmail.com"; //"yourmail@yoursite.com"; //from email adress $emailfrom =$_post['email']; //"contact@yoursite.com"; //email subject $emailsubject = "mail porta"; $name = $_post["name"]; $email = $_post["email"]; $comment = $_post["comment"]; if($name == "") $data['success'] = false; if (!preg_match("/^[_\.0-9a-za-z-]+@([0-9a-za-z][0-9a-za-z-]+\.)+[a-za-z]{2,6}$/i", $email)) $data['success'] = false; if($comment == "") $data['success'] = false; if($data['success'] == true){ $message = "name: $name<br> email: $email<br> comment: $comment"; $headers = "mime-version: 1.0" . "\r\n"; $headers .= "content-type:text/html; charset=utf-8" . "\r\n"; $headers .= "from: <$emailfrom>" . "\r\n"; mail($emailto, $emailsubject, $message, $headers); $data['success'] = true; echo json_encode($data); } } ?>
Comments
Post a Comment