Solution 1 :

Follow the example below to send emails:

create a file index.html and put the following:

<form method="post" action="subscriberform.php">
 <textarea name="message"></textarea>
 <input type="submit">
</form>

create a PHP file subscribeform.php and put the following:

<?php

if($_POST["message"]) {

 mail("[email protected]", "Here is the subject line", $_POST["insert your message here"]. "From: [email protected]");

}
?>

Now upload these files on your hosting and try it out.
If an email is not sent, then contact your hosting provider for your server configuration.

Solution 2 :

Unfortunately, it‘s not possible to only use HTML when performing actions like sending E-Mails. A possible way would be to create an input like this:

<input id="receiver" />
<input id="text" />
<button onclick="sendMail()">Send</button>

And a button for sending the mail. Then add a hidden link tag in your HTML:

<a id="sender" style="display: none;">Sender</a>

Now add this script to your HTML:

function sendMail() {
  document.getElementById("sender").href = "mailto:" + document.getElementById("receiver").value + "&body=" + encodeURIComponent(document.getElementById("text").value;
  document.getElementById("sender").click();
}

This will open up the mailing program of the user, and the user only has to click on „Send“ in his mailing program. Everything else is pre-filled.

Solution 3 :

<form class="row g-3 needs-validation" novalidate action="mailto:[email protected]” method=”post”
    enctype=”multipart/form-data” name=”EmailForm”>
    <div class=" col-md-4" style="margin-top: 2.4%">
    <div class="valid-feedback">
    </div>
    </div>
    <div class="col-md-4">
        <label for="floatingInput" class="form-label">First name</label>
        <input type="text" class="form-control" id="floatingInput" placeholder="Konnie">
    </div><br>
    <div class="col-md-4">
        <label for="floatingInput" class="form-label">Last name</label>
        <input type="text" class="form-control" id="floatingInput" placeholder="Smith" required>
    </div><br>
    <div class="form-floating mb-3">
        <input type="email" class="form-control" id="floatingInput" placeholder="[email protected]" required>
        <label for="floatingInput">Email address</label>
    </div>
    <div class="col-12">
        <div class="form-check">
            <input class="form-check-input" type="checkbox" value="" id="invalidCheck" required>
            <label class="form-check-label" for="invalidCheck">
                Agree to terms and conditions
            </label>
            <div class="invalid-feedback">
                You must agree before submitting.
            </div>
        </div>
    </div>
    <br>
    <div class="col-12">
        <button class="btn btn-primary" type="submit">Submit form</button>
    </div>
</form>

Problem :

I would like to create a form that sends the input of the form to a desired email when a submit button is clicked. Ideally, I would like to use HTML.

Here is what I’ve got so far:

<form class="row g-3 needs-validation" novalidate 
    action=”mailto:[email protected]”
    method=”POST”
    enctype=”multipart/form-data”
    name=”EmailForm”>
        <div class="col-md-4" style="margin-top: 2.4%">
            <div class="valid-feedback">
            </div>
        </div>
        <div class="col-md-4">
            <label for="floatingInput" class="form-label">First name</label>
            <input type="text" class="form-control" id="floatingInput" placeholder="Konnie"></div><br>
        <div class="col-md-4">
            <label for="floatingInput" class="form-label">Last name</label>
            <input type="text" class="form-control" id="floatingInput" placeholder="Smith" required>
        </div><br>
        <div class="form-floating mb-3">
                <input type="email" class="form-control" id="floatingInput" placeholder="[email protected]" required>
                <label for="floatingInput">Email address</label>
        </div>
  <div class="col-12"> <div class="form-check">
      <input class="form-check-input" type="checkbox" value="" id="invalidCheck" required>
      <label class="form-check-label" for="invalidCheck">
        Agree to terms and conditions
      </label> 
      <div class="invalid-feedback">
        You must agree before submitting.
      </div>
    </div>
  </div>
  <br>
  <div class="col-12">
    <button class="btn btn-primary" type="submit">Submit form</button>
  </div>
        </form>

When I try to submit the form, I get this error:

Not Found

The requested URL was not found on this server.

Comments

Comment posted by A_A

Have you tried

Comment posted by Abdullah Khan

Are you using any backend language? like PHP?

Comment posted by Roddy of the Frozen Peas

Of course it’s not going to work if the user doesn’t have a registered mail client (eg there’s no program to respond to the mailto protocol.)

Comment posted by Daniel A. White

you can’t automatically send an email with a bare html form – this will only open the user’s

Comment posted by this question

Also, have you tried the form from

Comment posted by this answer

Afaik, the same is possible without javascript, e.g. in with the code snippet from

Comment posted by A_A

Can you explain why this should work and the example from the OP not? I guess it’s the type of quotes used

Comment posted by sundeep sharma

before the action attribute quote was this ” and i replace the quote to this ” so the code is working

By