> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pult.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Email

> Reply to customers from your own domain and thread their answers back onto the item.

Pult never sends mail as your domain. Replies written in the console are sent by your app, with whatever provider you already use, and replies from customers come back through your app too.

## Sending

Give the inbox an address to reply to and a way to send:

```ts theme={null}
export const support = inbox("support", {
  data: z.object({
    email: z.email(),
    subject: z.string(),
    body: z.string().max(5000),
  }),
  title: (data) => data.subject,
  reply: {
    to: (item) => item.data.email,
    send: ({ to, subject, text, thread }) =>
      resend.emails.send({
        from: "support@acme.com",
        replyTo: `support+${thread}@acme.com`,
        to,
        subject,
        text,
      }),
  },
})
```

Items in this inbox get an Email tab next to notes. `send` runs inside your app and receives `to`, `subject`, `text`, `thread`, the `item` (with its data) and the `actor` who wrote it. If your app is offline, the reply waits and the timeline says so until it goes out.

## Threading replies

`thread` identifies the item's conversation. Put it somewhere a reply carries back: a plus address like above, or a header your provider keeps. When your provider's inbound webhook reaches your app, hand the message to Pult:

```ts theme={null}
app.post("/webhooks/inbound-email", async (c) => {
  const { to, from, subject, text } = await c.req.json()
  const thread = /\+([a-z0-9]+)@/.exec(to)?.[1]
  const received =
    thread && (await pult.receive({ thread, from, subject, text }))
  if (!received) {
    await pult.send(support, { data: { email: from, subject, body: text } })
  }
  return c.body(null, 204)
})
```

The message joins the item's timeline. If the item was closed it reopens, and whoever it's assigned to is emailed. `receive` returns `null` for a thread Pult doesn't know, so a new conversation becomes whatever you decide; above, a new support item.

## Pult's own email

Notifications to your team come from Pult's own address. They're the only mail Pult sends itself.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.