Docs menu
Getting started
IntroductionInstallationProject structureBuilding pages
RoutingPagesLayoutsStylingMarkdownContent and dataIslandsGoing live
SEO and headDeployingFormsGuides
Build a brochure siteAdvanced
Running as a serverReference
ReferenceGoing live
Forms
Contact forms on a static site, with a form service or a plain mailto link.
A static site has no server to receive a form, so a contact form goes to a form service, or you skip the form and link to your email.
Netlify Forms
On Netlify, mark the form and Netlify does the rest: it finds the form when you deploy, stores submissions and emails them to you.
<form$form name='contact' method='post' action='/contact/thanks' data-netlify='true'>
<input type='hidden' name='form-name' value='contact'>
<label>
"Email"
<input type='email' name='email' required=''>
<label>
"Message"
<textarea name='message' rows=5 required=''>
<button type='submit'> "Send"
actionis the page shown after sending. Give that pagenoindex: yes.- The hidden
form-namefield must match the form'sname. - For Netlify's spam honeypot, set
netlify-honeypotfrom code (Imba drops custom hyphenated attributes in templates):$form.setAttribute('netlify-honeypot', 'website')in the tag'srenderedmethod, plus a hiddenwebsitefield.
Any other service
Formspree, Basin and others work on any host: the form's action is their URL.
<form method='post' action='https://formspree.io/f/your-form-id'>
…
A demo form
For a demo or a prototype, a form can go straight to the thank-you page without sending
anything. Leave out the fields' name attributes so nothing ends up in the URL; the browser
still checks required fields. The example site's contact page works this way:
<form method='get' action='/contact/thanks/'>
<input type='email' autocomplete='email' required=''>
<button type='submit'> "Send"
Or just email
For a personal site, a mailto: link is often enough, and nothing can break:
<a href="mailto:hello@example.com?subject=Hello"> "Email me"
Handling the form yourself
If you want your own email wording, an auto-reply, or to send enquiries somewhere else, a
page can handle its own posts with export def post. That needs the site to run as a Node
server rather than static files; see Running as a server.