Developer guide

Form to email: four ways to send a website form, and when to stop

An HTML form cannot send email by itself. Something has to receive the submission, whether that is the visitor's mail app, your server, a hosted service or a database.

By the Miaalo team, FairShare IT Services, Pune. Published 8 November 2026.

How do the four options compare?

MethodSetupWhat breaks
mailto: actionOne attributeDepends on the visitor having a mail app set up
Server script over SMTPBackend and mail accountSpam filtering, and securing the script is on you
Hosted form backendChange the form's action URLReliable delivery, but enquiries still pile up in an inbox
Save to a contact listOne POST requestYou have to open the list to see new enquiries

Why not use a mailto form?

<form action="mailto:you@example.com"> hands the job to the visitor's own mail program. On a shared computer or a phone with no mail app set up, nothing useful happens, and you never find out that someone tried. Skip it for anything that matters.

When is a server script the right choice?

If you already run a backend, sending through a real SMTP account takes a few lines with any mail library. Use authenticated SMTP, since plain mail() calls from a web host are easy for spam filters to reject. Validate every field, and never put user input into mail headers without cleaning it, or your form becomes a spam relay.

What do hosted form backends solve?

Services in this category give you a URL to post to, then handle spam filtering and delivery. On a static site with no server, that's usually the fastest route to a working form, and for a contact page that gets three messages a month we'd stop here.

When does email stop working for enquiries?

All three options above end in an inbox, and an inbox is a poor database. Counting last month's enquiries means counting emails. A repeat enquiry arrives as a brand new message. Nobody can tell which ones got a call unless someone keeps a separate sheet, and then you're maintaining two lists.

How do you save form submissions to a list instead?

Post the form to something that stores it. This example sends each submission to Miaalo, which matches people by mobile number, so a repeat enquiry joins the existing contact. Nothing about your form's design has to change.

<form id="enquiry">
  <input name="name" required placeholder="Your name">
  <input name="phone" required inputmode="numeric" placeholder="10-digit mobile number">
  <input name="email" type="email" placeholder="Email (optional)">
  <button>Send enquiry</button>
</form>
<p id="result" role="status"></p>

<script>
document.getElementById("enquiry").addEventListener("submit", async (e) => {
  e.preventDefault();
  const body = Object.fromEntries(new FormData(e.target));
  body.api_key = "YOUR_SOURCE_KEY";

  const res = await fetch("https://miaalo.com/api/save-number", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(body)
  }).then((r) => r.json());

  document.getElementById("result").textContent =
    res.status === 1 ? "Thanks. We will call you soon." : res.data.message;
});
</script>

You can run this next to your email script if you want both. Miaalo accepts Indian mobile numbers only, and API access is switched on by request through info@fairshare.tech. If you need delivery to international addresses or numbers, a hosted form backend is the better fit today. Full details are in the form API docs, and there's more on form design in our lead form examples.