Skip to main content

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.

EmailResource reads messages over IMAP and sends via SMTP, exposing the mailbox as a tree of folders and messages.
Node only. Requires imapflow, mailparser, and nodemailer peers. The browser cannot speak raw TCP for IMAP/SMTP.

Install

pnpm add @struktoai/mirage-node imapflow mailparser nodemailer

Config

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/')
FieldDefaultNotes
imapHostrequiredIMAP server hostname.
imapPort993
smtpHostrequiredSMTP server hostname.
smtpPort465
usernamerequiredMailbox login.
passwordrequiredApp password. Redacted in snapshots.
useSsltrueImplicit TLS for both IMAP and SMTP.
maxMessages1000Hard 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.