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

# Email

> Mount an IMAP/SMTP mailbox as a Mirage filesystem (Node only).

`EmailResource` reads messages over IMAP and sends via SMTP, exposing the mailbox as a tree of folders and messages.

<Note>
  Node only. Requires `imapflow`, `mailparser`, and `nodemailer` peers. The browser cannot speak raw TCP for IMAP/SMTP.
</Note>

## Install

```bash theme={null}
pnpm add @struktoai/mirage-node imapflow mailparser nodemailer
```

## Config

```ts theme={null}
import { EmailResource, MountMode, Workspace } from '@struktoai/mirage-node'

const email = new EmailResource({
  imapHost: 'imap.example.com',
  smtpHost: 'smtp.example.com',
  username: process.env.EMAIL_USER!,
  password: process.env.EMAIL_PASSWORD!,
})

const ws = new Workspace({ '/mail': email }, { mode: MountMode.WRITE })
await ws.execute('ls /mail/INBOX/')
```

| Field         | Default  | Notes                                |
| ------------- | -------- | ------------------------------------ |
| `imapHost`    | required | IMAP server hostname.                |
| `imapPort`    | `993`    |                                      |
| `smtpHost`    | required | SMTP server hostname.                |
| `smtpPort`    | `465`    |                                      |
| `username`    | required | Mailbox login.                       |
| `password`    | required | App password. Redacted in snapshots. |
| `useSsl`      | `true`   | Implicit TLS for both IMAP and SMTP. |
| `maxMessages` | `1000`   | Hard ceiling per folder listing.     |

## Mount mode

`read`, `write` (sending mail via the synthesized `/sent/` path).

For mailbox layout, search behavior, and synthesized date directories see the [Python Email docs](/python/resource/email).
