Why use email inbox? Testing email-based flows (sign-up verification, password reset, magic links) requires receiving real emails. The inbox handles email delivery, filtering, and AI-powered extraction so you can focus on testing your application.
Installation
Install the@stablyai/email package:
Finding Your Email Address
Your organization’s email address follows the pattern{org-name}@mail.stably.ai. To find your specific address:
- Settings: Go to Settings > Email Inbox in your Stably project
- In code: Call
Inbox.build()— the returnedinbox.addresscontains your org’s full email
Viewing Received Emails
You can view all emails received by your inbox directly from the Stably web portal or programmatically via the SDK.- Web Portal
- SDK
Go to Settings > Email Inbox in your Stably project. The bottom of the page shows a list of all received emails with sender, recipient, subject, and date.
Use the Refresh button to fetch the latest emails. The “To” column shows which suffixed address each email was sent to, making it easy to trace emails back to specific test runs.

Email Object
Methods likeinbox.listEmails(), inbox.waitForEmail(), and inbox.getEmail() return Email objects with these properties:
Basic Usage
Create an inbox, trigger an email from your app, wait for it to arrive, and extract the data you need:Inbox.build
Creates an inbox instance scoped to your test. RequiresSTABLY_API_KEY and STABLY_PROJECT_ID environment variables (or pass them directly).
Options
Inbox Properties
The inbox automatically filters out emails received before
createdAt, so you only see emails from your current test.
inbox.waitForEmail
Polls until a new email matching your filters arrives. Only sees emails received after the inbox was created.Options
Throws
EmailTimeoutError if no matching email arrives within the timeout.
inbox.extractFromEmail
Extracts data from an email using AI. Returns{ data, reason } where data is the extracted value and reason describes how the extraction was performed.
EmailExtractionError if extraction fails.
inbox.listEmails
Lists emails in the inbox. By default, only returns emails received after the inbox was created.Options
inbox.getEmail
Gets a specific email by ID.inbox.deleteEmail / inbox.deleteAllEmails
Delete emails to clean up after your test.deleteAllEmails() only deletes emails sent to this inbox’s address, not your entire org mailbox.
Common Extraction Prompts
Using Fixtures
Create a reusable inbox fixture for automatic cleanup:Troubleshooting
Tests interfere with each other Use unique suffixes withInbox.build({ suffix: 'test-' + Date.now() }) to give each test its own isolated inbox. The inbox automatically filters to only show emails received after it was created.