---
title: "Test with the sandbox inbox"
description: "Read the mail a test-mode deployment sends to the provider's sandbox addresses, so a demo, a preview or an end-to-end test can sign in by code."
canonical_url: "https://nuxt-backend.dev/docs/email/sandbox-inbox"
---
# Test with the sandbox inbox

> Read the mail a test-mode deployment sends to the provider's sandbox addresses, so a demo, a preview or an end-to-end test can sign in by code.

In test mode — the default, until `EMAIL_TEST_MODE=false` — the provider delivers only to its sandbox addresses (`delivered@resend.dev`, with any `+label`), and nobody can open those mailboxes. The component keeps a copy of every message sent to one for an hour, so a demo, a preview deployment or an end-to-end test can still finish an email-code sign-in. The copy is kept whether or not `EMAIL_API_KEY` is set, sign-in codes included, so such a deployment needs no email provider at all. Nothing is kept for a real address, and nothing at all once test mode is off — turning it off also hides what was kept before.

Publishing the inbox is opt-in: re-export its query next to `getEmailStatus`, and read it with `useSandboxInbox`.

```ts [backend/email.ts]
export const { getEmailStatus, getSandboxInbox } = email.api
```

```vue
<script setup lang="ts">
// A fresh label per visitor keeps one visitor's mail out of another's inbox.
const address = ref(`delivered+${crypto.randomUUID()}@resend.dev`)
const inbox = useSandboxInbox({ address })
</script>

<template>
  <p v-if="inbox.code.value">Your sign-in code: {{ inbox.code.value }}</p>
</template>
```

`useSandboxInbox({ address })` returns the inbox newest first (`messages`), the newest message (`latest`), the first six-digit code in it (`code`), `isLoading`, and `error` when the inbox could not be read. It pauses while the address is empty.

<note>

The sandbox inbox is **experimental** (see [STABILITY.md](https://github.com/qruto/nuxt-backend/blob/main/STABILITY.md)): how long it keeps a message and the code it extracts may change in a minor release.

</note>

<warning>

The query is public and unauthenticated — a visitor reads it before they are signed in — so **anyone who knows an address can read its mail and sign in as it**. Publish it only where every account is a throwaway sandbox one, generate unguessable labels, and never show one user's address to another.

</warning>

<page-keys>

- Try it live in the playground: [/login](https://nuxt-backend.dev/login)
- API reference: [/docs/reference/api/use-sandbox-inbox](https://nuxt-backend.dev/docs/reference/api/use-sandbox-inbox)
- Source: [https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-sandbox-inbox.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-sandbox-inbox.ts)

</page-keys>


## Sitemap

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