# How to add a contact form to a static website

> Add a working contact form to your static website with HTML and SiteBackend. Receive email notifications, reduce spam, and test your live form.

Source: https://sitebackend.com/blog/static-website-contact-form · Updated: 2026-10-15

To add a contact form to a static website, give an HTML form an endpoint that receives its submissions. With SiteBackend, you create that endpoint in the dashboard, paste it into your form's `action`, and configure an email notification. Your website can stay on its current host, and the form works without JavaScript.

This walkthrough uses plain HTML. If you use a framework, browse the [contact form templates](https://sitebackend.com/templates) for a starting point. If an AI tool built your website, the [AI contact form guide](https://sitebackend.com/blog/ai-website-contact-form) includes a prompt for connecting your existing design.

## Why does a static contact form need an endpoint?

HTML can display fields, validate a required email address and send a request. Something still needs to receive that request, store the message and arrange any notification emails.

A form backend handles those steps. The flow in this guide is:

**Visitor fills in your form → browser posts to SiteBackend → message is saved → your configured email channel is notified.**

The form's destination and your email notification address are separate settings. You will connect and test both.

## 1. Create a form endpoint

1. [Create a SiteBackend account](https://sitebackend.com/signup).
2. Click **Add site** to create a site for your website.
3. Open the site, click **New form**, and name it something recognizable, such as “Website contact”.
4. Use **Copy** on the form's page to copy its endpoint.

It will look like this:

```text
https://api.sitebackend.com/forms/YOUR_FORM_ID
```

Use the full URL from your dashboard. The example's `YOUR_FORM_ID` must be replaced before the form can work.

The endpoint belongs in your public website code. You don't need an email password or a private API key in the HTML.

## 2. Add this HTML contact form to your website

Paste the following form into your contact page and replace the `action` URL with your endpoint. If you already have a form, keep its styling and update its `action`, `method` and field names to match this pattern.

```html title="contact.html"
<form action="https://api.sitebackend.com/forms/YOUR_FORM_ID" method="POST">
  <label for="contact-name">Your name</label>
  <input
    id="contact-name"
    type="text"
    name="name"
    autocomplete="name"
    required
  />

  <label for="contact-email">Your email</label>
  <input
    id="contact-email"
    type="email"
    name="email"
    autocomplete="email"
    required
  />

  <label for="contact-message">Message</label>
  <textarea
    id="contact-message"
    name="message"
    rows="6"
    required
  ></textarea>

  <!-- Leave this hidden field empty. It helps catch automated spam. -->
  <input
    type="text"
    name="_gotcha"
    tabindex="-1"
    autocomplete="off"
    style="display:none"
  />

  <button type="submit">Send message</button>
</form>
```

Every field you want to receive needs a `name`. An `id` connects a field to its label, but doesn't give the submitted value a name. Using `email` for the visitor's address also matches SiteBackend's default email field setting.

`method="POST"` sends the fields to the endpoint. The `_gotcha` field is a honeypot: people leave it empty, while bots may fill it in. It is one part of spam protection, so keep the form's spam filter enabled too.

If your existing page has JavaScript that intercepts submission and only displays “sent”, remove that placeholder behavior so the browser can submit this form. To keep visitors on the same page, use the [JavaScript submission guide](https://sitebackend.com/docs/forms/javascript-fetch) instead.

## 3. Configure email notifications

Open your form in SiteBackend, go to **Notifications → Add channel**, and choose **Email**. Enter the inbox that should receive messages, save the channel, and check that its test email arrives. Keep the channel enabled.

Use your own destination address here, such as your business inbox. The visitor enters their address in the HTML form's `email` field.

> **Note:** Notifications are configured per form. Signing up for SiteBackend doesn't automatically send every submission to your account's email address.

The **Notifications** tab also shows delivery status and errors. See the [notifications guide](https://sitebackend.com/docs/forms/notifications) for other channels and delivery retries.

For destination-specific setup, use the guides for [email](https://sitebackend.com/blog/html-form-to-email), [Telegram](https://sitebackend.com/blog/html-form-to-telegram), [Discord](https://sitebackend.com/blog/html-form-to-discord) or [a custom webhook](https://sitebackend.com/blog/html-form-to-webhook).

## 4. Choose what visitors see after submitting

An HTML submission redirects visitors to SiteBackend's thank-you page by default. You can change its success text in **Form → Settings → After submit → Success message**.

If your website already has a thank-you page, enter its full URL in **Redirect URL** in the same section, for example `https://example.com/thanks`. Publish that page before using it as a destination.

See [redirects and thank-you pages](https://sitebackend.com/docs/forms/redirects-and-thank-you) for details.

## 5. Test from your published website

Publish your contact page, then submit a message using an email address you control. Use distinctive text such as “Test from my live contact page” so you can find it easily.

Check each part of the flow:

| Where to check   | What to confirm                                                                                        |
| ---------------- | ------------------------------------------------------------------------------------------------------ |
| Your website     | Required fields block an empty submission, and submitting a completed form reaches the thank-you page. |
| SiteBackend      | The message appears in the correct form's inbox with the submitted fields.                             |
| Your email inbox | The notification arrives at the destination configured for that form. Check junk or spam too.          |

A thank-you screen alone doesn't prove an email arrived. Confirm the stored message and the notification separately.

If the message is missing, check the endpoint URL, confirm the form is active, and look in the form's spam folder. If it is stored but no email arrives, check that the email channel is enabled and inspect its delivery log. Free-plan submissions past the monthly limit are saved but hidden and don't send notifications; see [plans and limits](https://sitebackend.com/docs/workspace/plans-and-limits).

## How do I restrict submissions to my website?

After the first successful test, open **Form → Settings → Allowed origins** and add the origins your form uses, one per line:

```text
https://example.com
https://www.example.com
```

Replace those examples with your actual origins. Include your local development origin if you also test locally, then submit another message from the live site to confirm the settings.

Allowed origins restrict which browser origins can submit. Keep the honeypot and spam filter as well, and consider a supported CAPTCHA if you need another check. The [allowed origins guide](https://sitebackend.com/docs/forms/allowed-origins) and [spam protection guide](https://sitebackend.com/docs/forms/spam-protection) cover those settings.

Your contact form is ready when a visitor can submit from your published page, you can find the message in SiteBackend, and your notification reaches the intended inbox. Start with this HTML version, then add styling or a JavaScript interaction as your website needs it.
