Contact form for Cloudflare Pages
Cloudflare Pages serves your site statically. For a form you would otherwise have to write a Pages Function that sends emails and fends off spam. With FormPost you simply send the form to us.
Before you start: create a form in FormPost
Sign up for FormPost, create a form and enter the domain your site runs on. We then show you your form's address. It replaces https://www.formpost.eu/f/abc123 in the code below – nothing else needs to change.
Add the form to your site
The code below is a complete contact page. Whether you use plain HTML, a static site generator or a framework, copy the form block to the right place. Hugo, Jekyll, Astro and Eleventy have their own guides.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Contact</title>
</head>
<body>
<form action="https://www.formpost.eu/f/abc123" method="POST">
<label for="email">Email</label>
<input type="email" id="email" name="email" required>
<label for="message">Message</label>
<textarea id="message" name="message" required></textarea>
<input type="text" name="_gotcha" style="display:none;" tabindex="-1" autocomplete="off">
<button type="submit">Send</button>
</form>
</body>
</html>
Good to know
- Your own Pages Function is a real alternative if you want to maintain the code yourself. You then also take care of sending emails, spam protection and storing submissions.
- In FormPost, enter the domain your site runs on – your-project.pages.dev or your own domain.
- Preview deployments run under addresses such as 1a2b3c4d.your-project.pages.dev. On the Free plan we reject submissions from there. On Pro you can allow all subdomains for the form, and previews work too.
What FormPost cannot do today
- Forms are submitted the classic way, meaning the page changes. Sending in the background via JavaScript is not supported at present.
- We do not accept file attachments.
- FormPost does not collect consent from your visitors. The notice in your own privacy policy remains your job – the wording for it is waiting, ready to copy, next to your form.
More guides and comparisons
Create a form and try it
The Free plan covers one form with ten notifications a day and costs nothing, permanently.