A contact form for any static site
Your site is built files, so nothing on it can send an email. Point the form at FormHaven and every message reaches your inbox, stored in the EU and spam filtered, whatever generator or host you use.
14 days free, no card. Paste the address where the code says YOUR_FORM_ID.
<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">
<input type="hidden" name="_next" value="/thanks/">
<button type="submit">Send message</button>
</form>
Set it up
-
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
Paste the form once
Save the code above where your generator keeps reusable pieces (see below) and add it to your contact page.
-
3
Add a thank-you page
Make a page at /thanks/. The hidden _next field sends visitors there. Leave it out and they see our thank-you page instead.
-
4
Deploy and test
Build and deploy as usual. Nothing changes on the host: fill in the form on the live site and check your inbox.
Where the form goes in your generator
Every generator has a folder for pieces you reuse. Save the form there once and include it on any page. Astro and Hugo have their own guides with a component and a shortcode.
# Eleventy: _includes/contact-form.njk
{% include "contact-form.njk" %}
# Jekyll: _includes/contact-form.html
{% include contact-form.html %}
# Hugo: layouts/_partials/contact-form.html
{{ partial "contact-form.html" . }}
# Plain HTML: paste the form into contact.html
Stop spam without a captcha
The hidden _gotcha field already catches most bots. For the rest, turn on the bot check in the form's settings and add this line once to the page. The visitor's browser solves a small puzzle before the form sends: visitors see nothing, and it sets no cookies.
<script src="https://formhaven.net/bot-check.js" async></script>
Questions about this setup
- Which hosts does this work on?
- Any host that serves your built files: Netlify, Cloudflare Pages, GitHub Pages, Vercel or your own server. The form posts to FormHaven, so nothing has to run on the host when a visitor presses Send.
- Does it need JavaScript?
- No. It is a normal HTML form, so it works with JavaScript off. If you want the visitor to stay on the page, the HTML form to email guide has a short fetch script.
- Which backend is best for a static site contact form?
- It depends on what your client asks. Formspree has a free plan and stores submissions in the United States. Formspark sells one-time bundles and keeps submissions until you delete them. FormHaven stores them in the EU for the days you set per form, with a DPA, and has no free plan. The comparison pages list prices and limits with their sources.
- Can my client get the messages instead of me?
- Yes. Add up to 5 more addresses to the form. Each confirms by a link first, and their copy carries no FormHaven branding. You can turn your own copy off.
- Where is the data stored?
- On our servers in the EU, 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.