0

I start to learn HTMl my self. Made a contact form and copied code block as:

    <form id="ContactForm" action="">
        <div>
            <div class="wrapper">
                <input type="text" class="input" >Your Name:<br>
            </div>
            <div  class="wrapper">
                <input type="text" class="input" >Your E-mail:<br>
            </div>
            <div  class="wrapper">
                <textarea name="textarea" cols="1" rows="1"></textarea>Your Message:<br>
            </div>
            <a href="#" onClick="document.getElementById('ContactForm').submit()">Send</a>
            <a href="#" onClick="document.getElementById('ContactForm').reset()">Clear</a>
        </div>
    </form

The page show ok on browser, but the user cant send the form to my mail. I know may mail suppose be in somewhere on code,

What's missing?

Thanks

Haim Rodrik

  • 1
    Do you have any server side code? If not you'll need some before this form data will be saved/mailed at all. – Chris Olszewski Feb 24 '14 at 15:15
  • 1
    You'll either need a server-side solution like PHP to send email, or the old [mailto:](https://developer.mozilla.org/en-US/docs/Web-based_protocol_handlers) client side solution which opens the user's default email client to send an email. – j08691 Feb 24 '14 at 15:16
  • Thank you for reply , Yes , I have my own server and mail server. Don't have any sides for file server codes – user3347224 Feb 24 '14 at 16:41

1 Answers1

2

The simplest way of sending an email from your form is to use the mailto: action:

<form id="ContactForm" action="mailto:your@email.com">

When the form is submitted (when the user clicks the Send button) the default email client would be invoked with your email address and the form fields pre filled in the email. The user can edit the email and send it of.

However, this is not a reliable solution and probably not what you are looking for. In order to send emails "in the background" you will have to add some server side code to do handle your requests, for example PHP. If you have a working PHP server installed you can read the examples on how to send email in this thread for example: How to send an email using PHP?

Community
  • 1
  • 1
Johan
  • 21
  • 3