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.
<!-- 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
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
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
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
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.
<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.
<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.
<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
Get your form address in a minute
14 days free, no card. Then €1 per form a month, €0.50 from the 11th form.