Falkenstein, Germany · Hetzner Online GmbH
FormHaven

Why HTML form mailto breaks, and what to put in action instead

Putting mailto: in a form action does not send an email. It opens the visitor's mail app with a draft they still have to send, and for anyone reading Gmail or Outlook in a browser tab with no desktop mail app set up, pressing Submit does nothing. Swap that action for a form address and every message goes straight to your inbox.

14 days free, no card. Paste the address where the code says YOUR_FORM_ID.

contact.html
<!-- was: <form action="mailto:you@example.com" method="post" enctype="text/plain"> -->
<form action="https://formhaven.net/f/YOUR_FORM_ID" method="POST">
  <label>Your name <input type="text" name="name" required></label>
  <label>Your email <input type="email" name="email" required></label>
  <label>Message <textarea name="message" required></textarea></label>
  <input type="text" name="_gotcha" style="display:none" tabindex="-1" autocomplete="off">
  <button type="submit">Send message</button>
</form>

Swap action="mailto:" for a real form address

  1. 1

    Create a form in FormHaven

    Sign up, press New form and copy its address. It looks like https://formhaven.net/f/YOUR_FORM_ID.

  2. 2

    Replace mailto: in the action

    Put your form address in action and keep method="POST". Remove enctype="text/plain": the browser now sends standard form data over HTTPS, and your email address is no longer exposed in the HTML.

  3. 3

    Keep your field names

    Every named input becomes a labelled line in the email you receive. Name the visitor's address field email and pressing Reply in your inbox answers them directly.

  4. 4

    Test it in any browser

    Fill in the form and press Send. The visitor lands on a thank-you page without a mail app popping up, and the message arrives in your inbox.

What HTML form action="mailto:" actually does

If you need the mailto syntax for an internal page where every reader has a desktop mail client configured, this is the markup. enctype="text/plain" puts each field on its own line; leave it off and spaces arrive as plus signs with punctuation percent-encoded. Pressing Send only opens a draft in the visitor's mail program. On phones or browsers with no mail handler, a mailto contact form stops working and nothing opens.

mailto-only.html
<form action="mailto:you@example.com" method="post" enctype="text/plain">
  <label>Your name <input type="text" name="name"></label>
  <label>Message <textarea name="message"></textarea></label>
  <button type="submit">Open in mail app</button>
</form>

Send visitors to your own thank-you page

A mailto form never knows whether the visitor pressed Send inside their mail app, so it cannot show a confirmation page. With a form endpoint, add a hidden _next field to send the visitor to your own page once the message is stored, and _subject to set the email subject line.

contact.html
<input type="hidden" name="_subject" value="New message from the website">
<input type="hidden" name="_next" value="/thanks.html">

Keep scrapers and bots out of your inbox

Taking mailto: out of the HTML hides your email address from address harvesters, and the hidden _gotcha field catches bots that fill in every input. If spam still gets through, switch on the bot check in the form's settings and add this line once to the page. Visitors see nothing, and it sets no cookies.

contact.html
<script src="https://formhaven.net/bot-check.js" async></script>

Questions about this setup

Why is my mailto contact form not working in Chrome?
Chrome only opens a mailto form when the operating system has a default mail program or the visitor set a webmail site as their protocol handler. Most visitors read Gmail or Outlook in a regular browser tab without configuring that handler, so pressing Submit does nothing.
Can plain HTML send an email without mailto?
HTML in the browser cannot connect to a mail server on its own. Something on a server has to receive the form POST and send the email, either your own backend script or a hosted form endpoint in the action attribute.
Why did my mailto form arrive as one garbled line?
Without enctype="text/plain" on the form tag, the browser encodes the fields like a URL query string with plus signs and percent escapes. Adding enctype="text/plain" makes it readable in desktop mail clients that honour it, though several mobile browsers drop a mailto POST body either way.
Can my client receive the messages without putting their email in the HTML?
Yes. Add up to 5 confirmed addresses per form in FormHaven. Their email addresses never appear in the page source, their copies carry no FormHaven branding, and you can turn your own copy off.
Where are the messages stored?
On our servers at Hetzner in Falkenstein, Germany, for 1 to 365 days as you choose per form, or not at all: then each message is emailed and its answers deleted. A data processing agreement covers every account.

More to read

HTML form to emailSend an HTML form straight to your inbox Astro contact formA Contact.astro component for a static Astro site Static site contact formOne form for Astro, Hugo, Eleventy, Jekyll or plain HTML Hugo contact formA partial and a shortcode for a static Hugo site Lovable contact formOne prompt for a site built with Lovable GDPR compliant contact formEU storage, a DPA and retention you set Kontaktformular nach DSGVOAuf Deutsch: gespeichert in Deutschland, mit AVV JavaScript contact formA fetch script that keeps the visitor on the page Vercel contact formFor plain HTML, Astro or Next.js hosted on Vercel FormSubmit not workingThe usual causes of a silent FormSubmit form Web3Forms not workingThe usual causes of a silent Web3Forms form Eleventy contact formAn include for a static Eleventy (11ty) site Formspree not workingThe usual causes of a silent Formspree form Export from FormspreeEvery Formspree submission, as a file Export from FormsparkEvery Formspark submission, as a file EmailJS not workingThe usual causes of a silent EmailJS form Form backend for AI agentsThe start request, every REST route and MCP tool Claude Code contact formOne prompt, then press Activate Cursor contact formThe prompt and the .cursor/mcp.json entry Contact form privacy policyThe paragraph to copy, in 8 languages GitHub Pages contact formFor user, organisation and project sites on github.io Cloudflare Pages contact formFor sites on pages.dev or your own domain Netlify contact formFor sites on netlify.app or your own domain React contact formOne component for Vite and other React apps Next.js contact formA client component that works with output: export Send form submissions to multiple emailsUp to 5 confirmed addresses per form, plus yours SvelteKit contact formOne Svelte 5 component, any adapter Nuxt contact formOne Vue component for Nuxt 4 and 3 Gatsby contact formOne component for a Gatsby 5 site HTML form webhookSigned JSON to your endpoint for every message Jekyll contact formAn include for Jekyll, on GitHub Pages or any host Angular contact formA standalone component that posts with HttpClient Contact form spamWhy forms get spam, and the layers that stop it Contact form honeypotThe hidden field that catches bots, and how to hide it Contact form without PHPFor hosts with no PHP, or mail() that lands in spam Contact form templateThe same form in plain HTML Pricing€1 per form a month, €0.50 from the 11th

Get your form address in a minute

14 days free, no card. Then €1 per form a month, €0.50 from the 11th form.

Start your 14-day trial