---
title: "Add a contact form"
description: "Put <ContactForm> on a page: messages behind the bot check, a honeypot and rate limits, stored before anything is sent, each one a thread in your support inbox that your team answers by email, never emailed to the address a visitor typed."
canonical_url: "https://nuxt-backend.dev/docs/build/email/inbound/contact-form"
---
# Add a contact form

> Put <ContactForm> on a page: messages behind the bot check, a honeypot and rate limits, stored before anything is sent, each one a thread in your support inbox that your team answers by email, never emailed to the address a visitor typed.

Version: nuxt-backend 0.6.x · Tab: Build · Kind: how-to · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

- **You get:** a contact and feedback form on any page, safe to leave public, with every message a conversation your team answers from a shared inbox.
- **Powered by:** Resend Inboxes for the support inbox and its threads, and the bot check of your host (Vercel BotID, or a Turnstile challenge).
- **The package adds:** `<ContactForm>`, the honeypot and rate limits, the stored message, delivery into the support inbox, and the admin console's **Inbox** tab.

Give visitors a way to reach you, and signed-in people a way to say what they think, without a `mailto:` link or a form service. Put `<ContactForm>` on a page. Each message is checked, stored on your deployment, listed in the admin console, and posted to your [support inbox](https://nuxt-backend.dev/docs/build/email/inbound#the-support-inbox) as a thread your team answers.

## Add the form

Name your team's address on `setupEmail`, and add the form's write, `submitContactMessage`, to the `email.api` re-export. `getInboxConsole` and `replyToInbox` are the admin console's Inbox tab:

```ts [backend/email.ts]
export const email = setupEmail(components, {
  // …your other options
  contact: { to: 'support@panels.app' },
})

export const { getEmailStatus, submitContactMessage, getInboxConsole, replyToInbox, previewEmails, sendEmailPreview } = email.api
```

`<ContactForm>` calls it, shows its own confirmation once the message is stored, and needs no props.

Then put the form on a page:

```vue [app/pages/contact.vue]
<template>
  <main>
    <h1>Contact us</h1>
    <ContactForm />
  </main>
</template>
```

Signed out, the form asks for a name, an address to answer and a message. Signed in, it sends as the account and asks for the message alone, so the same component on a page behind sign-in is your feedback form. An administrator acting as someone can't send it in their name: the form answers `forbidden`, reason `impersonating`. A message runs from 10 to 2,000 characters. The form's words are labels, translated with the rest of the UI ([Change copy and labels](https://nuxt-backend.dev/docs/build/ui/customize/labels)).

## How a message is protected

A public form is a target, so every message passes these checks before it is stored:

- **The bot check.** The form asks `useHumanCheck()` for a token, and the deployment checks it with `verifyHuman`: Vercel BotID on Vercel, a Turnstile challenge elsewhere ([Turn on bot protection](https://nuxt-backend.dev/docs/build/auth/sign-in/bots#protect-your-own-calls)). On production with neither set up, the form is refused, never open.
- **A honeypot.** A field people never see; a bot that fills it reads "sent", and nothing is written.
- **Rate limits,** one per sender and one across the deployment, so a flood is refused before it costs anything. The per-sender key is the account, or a hash of the address, never the address itself. Pass your limiter as `setupEmail({ rateLimiter })` to tune `contact` and `contactGlobal` ([Tune rate limits](https://nuxt-backend.dev/docs/ship/security/rate-limits)).
- **No mail to the address typed in.** The form never emails the sender: no confirmation, no copy. A form that wrote to any address a visitor types would let anyone make your domain send mail to anyone. The confirmation is the page itself.

## Read the messages

The message is stored first, then delivered in the background, so a provider outage never loses one:

- **With inbound.support set,** it becomes a thread in the support inbox, with the sender's address as its reply-to. Your team answers from Resend's dashboard or the admin console, the reply goes out from the support address, and the person's answer lands on the same thread.
- **With only contact.to,** it is copied to that mailbox with the sender's address as its reply-to, and you answer from your own mail client. On a `development` deployment, the copy goes to the provider's sandbox inbox, `delivered@resend.dev`, instead: one setting serves every deployment, and a test message never reaches your team. A sandbox or a preview never sends it there, since its dev inbox may be a public page anyone reads: test mode holds the copy back, and the message waits in the admin console. Nor does it send a copy to a `contact.to` that is a test address itself, such as `delivered@resend.dev`, once its dev inbox is published (`EMAIL_DEV_INBOX=1`, which `deploy --sandbox` sets): the row reads "Kept here only". Give `contact.to` your team's real address on every deployment.
- **With neither,** messages stay in the admin console alone.

Administrators read every message in the admin console's **Inbox** tab, newest first, beside [inbound mail](https://nuxt-backend.dev/docs/build/email/inbound); the tab shows once `backend/email.ts` re-exports `getInboxConsole`. A message is personal data: it is kept for 90 days, erased with the account that sent it, and listed on the [Privacy and data inventory](https://nuxt-backend.dev/docs/ship/compliance/privacy) page.

## Test it

On your dev deployment, with `EMAIL_API_KEY` set, open the page signed out and send a message as `delivered@resend.dev`. It appears in the admin console's **Inbox** tab at once. A dev deployment is in test mode, which mails only the provider's test addresses, so the copy for `contact.to` goes to `delivered@resend.dev`, where [the dev inbox](https://nuxt-backend.dev/docs/develop/dev-inbox) shows it. Without the key no copy is sent; a support inbox at a real address, which wins over `contact.to`, is held back too, and so is a copy for a real address on a sandbox or a preview. The row then reads "Not sent: test mode, or no email key", and the log says `email.contact_held`. On production, the copy reaches the support inbox once the background delivery runs. Keep sending from the same address, and the per-sender limit soon refuses one with `rate_limited`, which the form shows.

## Related

- [Receive email](https://nuxt-backend.dev/docs/build/email/inbound): the inbound path the form shares.
- [Turn on bot protection](https://nuxt-backend.dev/docs/build/auth/sign-in/bots): the check in front of every form.
- [Tune rate limits](https://nuxt-backend.dev/docs/ship/security/rate-limits): the limits a form spends.
- [Run the admin console](https://nuxt-backend.dev/docs/build/auth/admin): where the messages land.


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
