Playground API
DocsStatsBlogStudio
Documentation Tree
Technical BlogFeature Deep Dives
  • Introduction
  • Quickstart
    5 min
  • How It Works
  • Recipes & Cookbooks
  • Platform Comparisons
  • Real-World Showcase
  • Interactive Studio
    Studio
  • GraphiQL IDE
    IDE
  • Session Quotas & Activity
  • Network Chaos Simulator
  • Atomic Sandbox Reset
  • Overview & Models
    Hub
  • Users Resource
  • Posts Resource
  • Comments Resource
  • Todos Resource
  • Custom Collections
    Custom
  • Multipart File Uploads
    Upload
  • Dynamic SVG Avatars
    SVG
  • Image Thumbnails
    CDN
  • Relational Filtering
  • Full-Text Search
  • Dynamic Sorting
  • Offset Pagination
  • Cursor Pagination
    Scroll
  • CSV & Excel Export & Import
    IO
  • Custom Collections
    CRUD
  • Overview & Architecture
    Hub
  • JWT Auth Flow
  • Refresh Token Rotation
    Mutex
  • RBAC Permission Matrix
    Roles
  • Expiry Simulation
  • Clock Skew Drift
  • Password Recovery Loop
  • Dual-Mode Sandboxing
  • GraphiQL IDE
    IDE
  • Relational Queries
  • Stateful Mutations
  • Realtime Subscriptions
  • Overview & Flowcharts
    Hub
  • Hosted Checkout
    Stripe
  • Payment Intents API
  • 3DS Challenge Modal
    Modal
  • Customers Vault
  • Charges & Refunds
  • Test Cards Catalog
  • Overview & Channels
    Hub
  • Virtual Email Mailbox
    Mailtrap
  • Virtual SMS Terminal
    Phone
  • In-App Notifications
  • Message Dispatcher
  • Realtime Studio
    Studio
  • Native WebSocket (/ws)
  • Socket.io Gateway
  • Presence & Echo Bot
  • Server-Sent Events (SSE)
    SSE
  • Analytics Telemetry
  • Webhook Subscriptions
  • HMAC SHA-256 Signatures
  • Delivery Logs
  • Manual Retry Simulator
  • Network Latency Delay
  • HTTP Status Codes
  • Rate-Limit Simulator
    429
  • Flaky Network & Jitter
    Chaos
  • Session Quotas & Activity
  • JSON Snapshots
    JSON
  • Headless CI/CD Testing
    CI
  • Mobile QR Code Sync
  • System Metrics & Health
  • Atomic Sandbox Reset
  • Official TypeScript SDK
  • Multi-Language Generators
  • DevTools Extension
  • OpenAPI 3.1 Spec
    JSON
  • Postman Collection v2.1
  • Bruno Collection
  • Insomnia Workspace
  • TypeScript .d.ts
    .d.ts
  • AI Prompt Rules
    Rules
  • Context Index (llms.txt)
  • Full Schema (llms-full.txt)
  • Manifest (product.json)
  • All Feature Articles
    Blog
  • React CRUD Without Backend
    Deep Dive
  • Why Static APIs Fail
  • Mocking Stateful Auth
  • WebSockets & SSE Guide
Technical Blog
Articles

In-depth articles explaining stateful mock APIs, WebSockets, payments, and frontend resilience.

Read Articles
PreviousOverview & Channels
NextVirtual SMS Terminal
Virtual Communications

Virtual Email Mailbox

An isolated, Mailtrap-style virtual inbox that intercepts transactional emails sent from your application, authentication flows, and payment receipts. Features automatic 6-digit OTP extraction, sandboxed HTML rendering, attachment downloads, and security header verification.

Live Sandbox MailboxHow Interception WorksSend Test Email ConsoleCI/CD OTP Endpoint
Live Session Inbox0 messages
To:

No messages match your criteria.

Trigger a password reset or order checkout to receive an email.

Select an email from the left pane to view its contents.

Under The Hood Architecture

How Virtual Email Interception Works

A zero-SMTP simulation pipeline designed for fast feedback loops in local development and automated CI/CD pipelines.

1. INGESTION

Dual Trigger Influx

Accepts outbound emails directly via POST /emails/send, or automatically triggered by internal flows (e.g. checkout payment receipts, password reset loops).

2. EXTRACTION

Smart OTP & Link Regex

Analyzes HTML and plain text bodies on the fly, extracting 6-digit OTP codes and authentication magic links into direct JSON fields for zero-friction copying or test querying.

3. ZERO-SMTP

Isolated Sandbox Store

Emails are kept strictly in your session sandbox overlay without hitting real SMTP relays or spam filters. Enriched with simulated SPF, DKIM, and TLS verification headers.

4. CONSUMPTION

Real-Time & CI/CD

Instantly pushed via SSE events to this live split-pane UI, or asserted headlessly in Playwright, Cypress, and Jest using GET /emails/otp?to=....

Node.js / Next.js / Express Integration Helper

Zero SMTP credentials needed
typescript
1
// utils/sendVirtualEmail.ts
2
// In development & staging, route your transactional emails to the playground sandbox!
3
export async function sendTransactionalEmail({ to, subject, html, text }: {
4
to: string;
5
subject: string;
6
html?: string;
7
text?: string;
8
}) {
9
if (process.env.NODE_ENV === 'production') {
10
// Return real Resend / SendGrid / Postmark transport here
11
return sendViaProductionProvider({ to, subject, html, text });
12
}
13
14
// Intercept in sandbox!
15
const res = await fetch('https://playground.nileslabs.com/api/v1/emails/send', {
16
method: 'POST',
17
headers: { 'Content-Type': 'application/json' },
18
body: JSON.stringify({ to, subject, html, text })
19
});
20
21
return res.json();
22
}

Dispatch Test Transactional Email

Send an email via POST /emails/send to see it appear in real-time in your sandbox inbox above.

Send Transactional Email

POST
response.json
1
{
2
// Click "Send" above to execute this request against the live server.
3
}

Headless CI/CD Testing & OTP Extraction

Query GET /api/v1/emails/otp?to=<recipient> to assert authentication flows in Playwright, Cypress, or Jest.

Playwright Verification Loop

typescript
1
// Playwright test verifying signup OTP email
2
const res = await fetch('https://playground.nileslabs.com/api/v1/emails/otp?to=developer@example.com');
3
const { otp, magic_link } = await res.json();
4
5
console.log('Extracted OTP code:', otp);
6
await page.fill('#otp-input', otp);
7
await page.click('#submit-btn');

Direct cURL Assertion

bash
1
# Fetch the latest OTP code received for developer@example.com
2
curl -s "https://playground.nileslabs.com/api/v1/emails/otp?to=developer@example.com" \
3
-H "Accept: application/json"
4
5
# Response:
6
# {
7
# "otp": "582194",
8
# "recipient": "developer@example.com",
9
# "subject": "Your Security Code is 582194"
10
# }