# Send an HTML form to email

> Add a working form to any website with FormDoc. Get an access key, paste the form and receive submissions by email.

FormDoc receives your HTML form’s submissions and emails them to you. You don’t need a server or any backend code.

## 1\. Get an access key

Go to [app.formdoc.dev/new](https://app.formdoc.dev/new), enter the email address that should receive submissions, and confirm it from the email we send. You then get an access key that starts with `fd_`. We email it to you as well.

## 2\. Add the form to your page

```html
<form action="https://api.formdoc.dev/v1/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">

  <label for="name">Name</label>
  <input type="text" id="name" name="name" required>

  <label for="email">Email</label>
  <input type="email" id="email" name="email" required>

  <label for="message">Message</label>
  <textarea id="message" name="message" required></textarea>

  <!-- Spam trap: keep it hidden and empty. -->
  <input type="checkbox" name="botcheck" style="display:none" tabindex="-1" autocomplete="off">

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

Replace `YOUR_ACCESS_KEY` with your key. Every input needs a `name`: that name becomes the label in your email.

## 3\. Send a test

Open your page, fill in the form and submit it. You’ll see a thank-you page, and the submission arrives in your inbox.

## Useful hidden fields

| Field | What it does |
| --- | --- |
| `subject` | Sets the email subject |
| `from_name` | Sets the sender name shown in your inbox |
| `redirect` | Full `https://` address of your own thank-you page |
| `replyto` | Address your reply goes to (otherwise the `email` field is used) |
| `botcheck` | Honeypot: must stay empty |

## Style your form

FormDoc only receives the data, so the form looks however you style it. Classes from your CSS framework work as usual. For example, with Tailwind CSS:

```html
<input type="email" name="email" required class="w-full rounded-lg border px-3 py-2">
<button type="submit" class="rounded-full bg-black px-5 py-2 text-white">Send</button>
```

Or with Bootstrap: `class="form-control"` on inputs and `class="btn btn-primary"` on the button.

## Sending with JavaScript

Send the form with `fetch` and ask for JSON to show your own success message:

```js
const res = await fetch("https://api.formdoc.dev/v1/submit", {
  method: "POST",
  headers: { Accept: "application/json" },
  body: new FormData(form),
});
const result = await res.json(); // { success: true, ... } or { success: false, error: { code, message } }
```

## Next

-   [API reference](https://www.formdoc.dev/docs/api-reference/): every field, limit and error code.
-   [Webhooks](https://www.formdoc.dev/docs/webhooks/): send each submission to your own server (paid plans).
