无法通过联系表单发送电子邮件

时间:2017-10-04 02:42:45

标签: html css

我似乎无法通过我的联系表单框将邮件定向到我的电子邮箱,就像点击发送邮件按钮后它只是将页面刷新为连续循环。

<div class="wow fadeInUp col-md-6 col-sm-12" data-wow-delay="1.6s">
    <h1>Questions/comments</h1>
    <div class="contact-form">
        <form id="contact-form" method="post" action="mailto:kaykaesu@gmail.com">
            <input name="name" type="text" class="form-control" placeholder="Your Name" required>
            <input name="email" type="email" class="form-control" placeholder="Your Email" required>
            <textarea name="message" class="form-control" placeholder="Message" rows="4" required></textarea>
            <div class="contact-submit">
                <input type="submit" class="form-control submit" value="Send a message">
            </div>
        </form>
    </div>
</div>

3 个答案:

答案 0 :(得分:2)

Object.assign()

尝试添加

var old_arr = [
  {itemID: 10, color: "blue"},
  {itemID: 11, color: "red"},
  {itemID: 12, color: "green"}
  ]

var new_arr = [
  {itemID: 11, color: "purple", size: "small"},
  {itemID: 12, color: "yellow", size: "large"}
  ]

var mixed = Object.assign( 
  old_arr.reduce((acc, curr) => (acc[curr.itemID] = curr, acc), {}),
  new_arr.reduce((acc, curr) => (acc[curr.itemID] = curr, acc), {})
)

var final  = Object.keys(mixed).map(key => (Object.assign({itemID: key},  mixed[key])))
console.log(final)

到表单标签。 如果这不起作用,则很可能是操作系统问题 Microsoft file association to mailto

*在我这边你的代码工作正常

答案 1 :(得分:-1)

仅当填写表单的人在其设备中设置了邮件客户端时,此功能才有效。要确保它在所有方案中都能正常运行,您需要一个服务器脚本,并将表单的操作属性指向该脚本。

否则您可以使用第三方服务,例如Typeform

答案 2 :(得分:-1)

      <?php
       if(isset($_POST['submit']))
         {
        $name=$_POST['name'];
        $email=$_POST['email'];
        $message=$_POST['message'];
          $body="Name:".$name."\n"."Email:".$email."\n"."Message: 
          \n".$message;
       if(mail("abc@gmail.com","Query through 
       Website",$body,"From:".$email))
      echo "<p align='center' style='color:green'>Your message has reached 
       destination.Rest Easy (^_^)..!!  We will contact you Shortly</p>";
        else
       echo "<p align='center' style='color:red'>Damn server!Apologies, but 
      something went wrong.Please try again (T_T)</p>";
         }
         ?>

    <div class="wow fadeInUp col-md-6 col-sm-12" data-wow-delay="1.6s">
<h1>Questions/comments</h1>
<div class="contact-form">
     <form  method="post" name="myform" onsubmit = "return validate()">
        <input name="name" type="text" class="form-control" placeholder="Your Name" required>
        <input name="email" type="email" class="form-control" placeholder="Your Email" required>
        <textarea name="message" class="form-control" placeholder="Message" rows="4" required></textarea>
        <div class="contact-submit">
            <input name="submit"  value="Send Message" type="submit" class="form-control submit" value="Send a message">
        </div>
    </form>
</div>