Falkenstein, Germany · Hetzner Online GmbH
FormHaven

A contact form without PHP

The classic contact form is a PHP script that calls mail(). A static host has no PHP to run it, and where it does run, its emails leave from the web server rather than your domain's mail service, so they can end up in spam. Point the form at an address that sends the email for you, and the page stays plain HTML.

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

contact.html
<!-- was: <form action="contact.php" method="post"> -->
<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 the PHP for one 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

    Change the action

    Replace contact.php in the action with your form's address. Keep the field names you already have: each one becomes a line in the email.

  3. 3

    Take the PHP file off the server

    Once the form posts elsewhere, contact.php has no job left. Delete it so nothing can still post to it.

  4. 4

    Send a test

    Fill in the form on the live site and check your inbox. Press Reply to answer: it goes to the address the visitor typed.

Where each line of the PHP script went

Your address is saved once in the dashboard instead of in a file on the server, the subject comes from a hidden _subject field, Reply goes to the visitor's email field, and _next sends the visitor to your thank-you page.

contact.php (before)
<?php
$to = 'you@example.com';                // now: saved on the form in the dashboard
$subject = 'New message from the site'; // now: <input type="hidden" name="_subject">
$headers = 'Reply-To: ' . $_POST['email']; // now: the email field, set as Reply-To
mail($to, $subject, $_POST['message'], $headers);
header('Location: /thanks.html');       // now: <input type="hidden" name="_next">

Your own thank-you page

Add a hidden _next field and visitors land on your page after they press Send. A relative address opens on the site the form was sent from. FormHaven only follows _next to that site, or to the site saved on the form, so nobody can use your form to send visitors somewhere else.

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

Stop bots that skip the hidden field

The hidden _gotcha field catches bots that fill in every field. For the rest, turn 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

My host runs PHP. Why switch?
You do not have to. Switch when mail() messages go missing or land in spam, when you want old messages kept somewhere you can read them, or when the site moves to a static host.
Does this work with JavaScript off?
Yes. It is a normal HTML form posting to an address, so the browser sends it without any script.
Which hosts does this work on?
Any host that serves HTML: GitHub Pages, Netlify, Cloudflare Pages, a storage bucket or the shared hosting you have now.
Can my client get the messages instead of me?
Yes. Add up to 5 more addresses to the form. Each one 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

HTML form to emailThe full setup, with a fetch version 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 HTML form mailtoWhy action="mailto:" fails on webmail visitors, and the one-line fix 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