Docs / Hosting
Contact form for Cloudflare Pages
Post a plain HTML form to Wrenform from a Pages site. No Function, mail provider or spam handling to build.
<form action="https://wrenform.com/f/YOUR_FORM_ID" method="POST">
<input type="text" name="name" required>
<input type="email" name="email" required>
<textarea name="message" required></textarea>
<input type="text" name="_honey" style="display:none" tabindex="-1" autocomplete="off">
<button type="submit">Send</button>
</form>
<!-- Optional: a timing check against bots, and data-ajax to submit in place -->
<script src="https://wrenform.com/js/v1/form.js" defer></script>Steps
- Create a form and copy its form ID, or let your AI tool create one without an account.
- Put the form in any page of your site, with your form ID in the
action. It's plain HTML, so it works with any framework or none. - Add a thank-you page, for example
thanks.html, and set its full address as the form's Redirect to, for examplehttps://PROJECT.pages.dev/thanks.htmlor your custom domain. See redirects. - Deploy as usual.
- In the form's settings, add your site under Allowed origins:
https://PROJECT.pages.dev, and your custom domain if you have one.
Preview deployments
Preview and branch deployments get their own subdomains of PROJECT.pages.dev. To accept submissions from them too, add https://*.PROJECT.pages.dev under Allowed origins: it matches every subdomain, but not https://PROJECT.pages.dev itself, so keep that entry as well. Or test from production only.
Ask your AI
Add a contact form to this Cloudflare Pages site using Wrenform. Use plain HTML that posts to https://wrenform.com/f/YOUR_FORM_ID with method POST, with name, email and message fields and the hidden _honey field. Add a thank-you page. Don't write a Pages Function or use mailto. Then tell me to add the site's address under Allowed origins in Wrenform.No form ID yet? The prompts for AI builders let the tool create one without an account.
When a Function is the better fit
If you need to change the data, or write it to your own database, before anything is sent, write a Pages Function for that instead. When a form only needs to reach your inbox, plain HTML posting to Wrenform is enough.
Test it
Open the deployed page, send the form, and you should land on your thank-you page. The submission shows in your dashboard and arrives by email. The first time, confirm the recipient address from the email we send.
Common problems
origin_not_allowed. The page's address isn't under Allowed origins. A preview deployment needs the*.PROJECT.pages.deventry above. See errors.- You see our thank-you page, not yours. Redirect to is empty, or it isn't an
https://address. - No email arrives. The recipient hasn't confirmed yet. See notifications.
Next steps
- My form isn't working: symptom, cause and fix.
- Spam: the honeypot, and the optional helper script that adds a timing check.
- Fields: subjects, reply-to and lists.
- GitHub Pages, Vercel and Netlify: the same form on other hosts.