How to Make a Contact Form Send Email Using HTML

If you have a website and want to allow visitors to contact you easily, adding a contact form can be a great idea. In this guide, we’ll walk you through the process of creating a simple contact form in HTML that can send emails. Don’t worry if you’re not familiar with coding – we’ll keep things easy and straightforward.

What You’ll Need

Before we dive in, let’s make sure you have everything you need:

  1. Text Editor: You’ll need a basic text editor to write your HTML code. Notepad (Windows) or TextEdit (Mac) will work just fine.

  2. Internet Connection: To access any third-party services, you’ll need an active internet connection.

Creating the Contact Form

Let’s start by creating the actual contact form using HTML:

<!DOCTYPE html>
<html>
<head>
    <title>Contact Us</title>
</head>
<body>
    <h1>Contact Us</h1>
    <form action="PROCESSING_URL" method="POST">
        <label for="name">Name:</label>
        <input type="text" id="name" name="name" required>
        <br>
        <label for="email">Email:</label>
        <input type="email" id="email" name="email" required>
        <br>
        <label for="message">Message:</label><br>
        <textarea id="message" name="message" rows="4" cols="50" required></textarea>
        <br>
        <input type="submit" value="Send">
    </form>
</body>
</html>

Replace "PROCESSING_URL" with the actual URL where you will process the form data.

Using Formspree To Send Email

To process the form data and send emails, we’ll use a third-party service called Formspree. Here’s how:

  1. Go to Formspree website.
  2. Sign up using your email.
  3. Once logged in, click “New Form” and enter a name for your form.
  4. You’ll be provided with a Formspree endpoint. Replace "PROCESSING_URL" in your HTML code with this endpoint.
  5. Formspree will handle the data and send you an email whenever someone submits the form.

Customizing and Styling

You can customize the form to match your website’s look and feel. You can modify the labels, input fields, and even add CSS for styling. However, if you’re not comfortable with styling, don’t worry – the basic form will work just fine.

Testing the Contact Form

After setting up the form, it’s essential to test it to ensure everything works as expected. Fill out the form with test information and submit it. You should receive an email to the address you used to sign up for Formspree.

Wrapping Up

Congratulations! You’ve successfully created a contact form that can send emails using HTML and Formspree. This simple form allows visitors to get in touch with you without revealing your email address. With this basic knowledge, you can start enhancing and adding more features to your website’s forms.

author's bio photo

Hi there! I am Avic Ndugu.

I have published 100+ blog posts on HTML, CSS, Javascript, React and other related topics. When I am not writing, I enjoy reading, hiking and listening to podcasts.