# Serverless form to email API

Turn static or frontend-hosted HTML forms into reliable email workflows with spam controls, alias routing, and attachment support.

Use the forms endpoint to receive submissions from HTML forms without hosting a custom email backend.

This is useful for contact forms, intake forms, lead capture pages, and lightweight support workflows where you need delivery reliability more than backend complexity.

## Quick start

Submit any HTML form to:

`https://api.mailslurp.com/forms`

Provide destination metadata using `_to` or `_toAlias`, then include normal form fields and optional attachments.

```html
<form action="https://api.mailslurp.com/forms" method="post" enctype="multipart/form-data">
  <input type="hidden" name="_to" value="ops@example.com" />
  <input type="hidden" name="_subject" value="Website contact" />
  <input type="hidden" name="_spamCheck" value="" />
  <input name="_emailAddress" type="email" placeholder="Your email" />
  <textarea name="message" required></textarea>
  <button type="submit">Send</button>
</form>
```

## Routing model

1. **Submission endpoint** accepts form fields and files.
2. **Meta parameters** control recipient, subject, redirects, and anti-spam behavior.
3. **Delivery target** can be direct mailbox (`_to`) or alias (`_toAlias`).
4. **Response behavior** returns success message or redirect target for frontend UX.

## Use aliases for safer public forms

If your form is public, avoid exposing destination mailbox addresses in client markup.

Use `_toAlias` with a pre-created alias ID so you can rotate destination inboxes without changing frontend code.

See: [Email aliases](https://www.mailslurp.com/product/aliases/)

## Anti-spam and abuse controls

- Add hidden `_spamCheck` honeypot and keep it empty.
- Use purpose-scoped aliases per form to isolate abuse.
- Monitor unexpected volume spikes and rotate aliases when needed.
- Route high-risk forms to automation rules for moderation workflows.

## Form API parameters most teams use

- `_to`: destination email address
- `_toAlias`: alias ID instead of plain address
- `_subject`: email subject
- `_emailAddress`: submitter reply address
- `_redirectTo`: post-submit redirect
- `_successMessage`: custom success text
- `_spamCheck`: honeypot field

## When to move beyond basic form-to-email

If your workflow needs branching logic, ticket enrichment, or structured extraction, route form messages into automation pipelines:

- [Email automation routing](https://www.mailslurp.com/product/email-automation-routing/)
- [AI email parsing and extraction](https://www.mailslurp.com/product/ai-email-parsing-structured-content-extraction/)
- [Testing webhooks](https://www.mailslurp.com/guides/testing-webhooks/)

This keeps your frontend simple while still giving operations teams controlled routing and observability.
