Static sites still need contact and lead-capture forms. This guide shows how to submit HTML form data directly to email without managing your own backend endpoint.

## Quick answer: how does form-to-email work?

1. Your browser posts form data to a form endpoint.
2. Routing fields (such as `_to`) define where the payload goes.
3. The platform converts submission data into a delivered email.
4. Optional redirect/success fields control post-submit UX.

## 1) Start with a valid HTML form

Use `method="post"` and a correct `action` URL:

```html
<form action="https://api.mailslurp.com/forms" method="post">
  <input name="name" placeholder="Your name" required />
  <input name="email" type="email" placeholder="you@company.com" required />
  <textarea name="message" placeholder="How can we help?" required></textarea>
  <button type="submit">Submit</button>
</form>
```

## 2) Add a hidden destination field

```html
<form action="https://api.mailslurp.com/forms" method="post">
  <input type="hidden" name="_to" value="support@example.com" />
  <input type="hidden" name="_subject" value="New contact form submission" />
  <input name="name" placeholder="Your name" required />
  <input name="email" type="email" placeholder="you@company.com" required />
  <textarea name="message" placeholder="How can we help?" required></textarea>
  <button type="submit">Submit</button>
</form>
```

`_to` tells MailSlurp where to deliver the submission email.

## 3) Configure post-submit behavior

Use `_redirectTo` to send users to a thank-you page:

```html
<input type="hidden" name="_redirectTo" value="https://example.com/thanks" />
```

Or show inline success text:

```html
<input type="hidden" name="_successMessage" value="Thanks - we received your request." />
```

## 4) Support file uploads

Add `enctype="multipart/form-data"` plus file inputs:

```html
<form action="https://api.mailslurp.com/forms" method="post" enctype="multipart/form-data">
  <input type="hidden" name="_to" value="support@example.com" />
  <input name="email" type="email" required />
  <input name="attachment" type="file" />
  <button type="submit">Submit</button>
</form>
```

## 5) Add anti-abuse controls before going live

Serverless form endpoints can attract spam. Minimum controls:

- Add a honeypot field and drop submissions when populated
- Add rate limits at CDN/WAF layer
- Require required fields and strict input lengths
- Route suspicious patterns to moderation inboxes

## Form-to-email vs API+webhook pipeline

| Use case                                            | Best fit                               |
| --------------------------------------------------- | -------------------------------------- |
| Basic contact forms on static pages                 | Form-to-email endpoint                 |
| Structured workflows with retries and routing logic | API + webhook automation               |
| Audit-heavy enterprise intake                       | API + storage + workflow orchestration |

## Operational checklist

1. Validate `_to` and subject routing in staging.
2. Confirm success/redirect behavior for mobile and desktop.
3. Test file upload paths and attachment visibility.
4. Run spam and deliverability checks before launch.
5. Add monitoring for submission volume anomalies.

## Related routes

- [Email webhooks](/guides/email-webhooks/)
- [What is a webhook?](/blog/what-is-a-webhook/)
- [Email integration testing](/product/email-integration-testing/)
- [Email Sandbox](/product/email-sandbox/)
- [Email deliverability test](/testing/email-deliverability-test/)

## Final take

HTML form-to-email is a fast way to ship contact capture on static properties. Treat it as production infrastructure: validate delivery, control abuse, and define upgrade paths to API-driven automation as volume grows.
