1

I can't seem to get my contact form box to direct the mail to my email, like after I hit the send message button it just refreshes the page as a continuous loop.

<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>
Carl Binalla
  • 5,393
  • 5
  • 27
  • 46
kaykae Su
  • 11
  • 1
  • Possible duplicate of [Mailto on submit button](https://stackoverflow.com/questions/12626940/mailto-on-submit-button) – Carl Binalla Oct 04 '17 at 02:53

3 Answers3

2

<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"  enctype="text/plain">
            <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>

Try adding

enctype="text/plain"

To the form tag. If this doesn't work then it most likely an OS problem Microsoft file association to mailto

*On my side your code is working fine

ShlomyN
  • 426
  • 2
  • 5
-1

This will work only if the one who is filling the form has a mail client setup in his / her device. To ensure it works properly in all scenarios, you need a server script and point the action attribute of form to that script.

Or else you can use a third party service like Typeform

-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>

coder
  • 614
  • 3
  • 12
  • 33