Written by: Geoffrey Callaghan
How to setup Contact Form with Netlify Hosting
How To Setup Contact Form With Netlify Hosting
Setting up a contact form with Netlify hosting involves creating an HTML form, configuring form handling in your static site, and utilizing Netlify’s form submission capabilities. Here’s a step-by-step guide:
Create an HTML contact form in your project:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact Form</title>
</head>
<body>
<h1>Contact Us</h1>
<form name="contact" method="POST" data-netlify="true">
<input type="hidden" name="form-name" value="contact">
<div>
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
</div>
<div>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
</div>
<div>
<label for="message">Message:</label>
<textarea id="message" name="message" required></textarea>
</div>
<button type="submit">Submit</button>
</form>
</body>
</html>
In this form:
form
element includes data-netlify="true"
, which tells Netlify to handle form submissions.input
with name="form-name"
and value="contact"
is required for Netlify form detection.Once your site is deployed, visit the contact page and submit the form. Netlify will handle the form submission and provide a notification in the Netlify dashboard.
By default, Netlify will send you an email notification for each form submission. You can configure form notifications in the Netlify dashboard:
Netlify provides a simple interface for managing form submissions:
Setting up a contact form with Netlify hosting is straightforward. By following these steps, you can quickly add a contact form to your static site and leverage Netlify’s form handling capabilities for easy management of form submissions.