Skip to main content
Yasumu includes a built-in catch-all SMTP server for testing email functionality in your applications. The server intercepts all emails sent to it, regardless of the recipient address, making it perfect for development and testing workflows.

How it works

The SMTP server runs locally within Yasumu and captures all incoming emails:
1

Start the server

Configure and start the SMTP server with optional authentication
2

Configure your application

Point your application’s SMTP settings to localhost with the configured port
3

Send emails

Your application sends emails normally
4

Inspect in Yasumu

All emails appear in Yasumu’s email viewer with full content and metadata

Server configuration

Configure the SMTP server through Yasumu’s settings:
email.ts:12-34
// Get current SMTP configuration
const config = await workspace.email.getSmtpConfig();

// Update configuration
await workspace.email.updateSmtpConfig({
  port: 1025,        // SMTP port (0 for auto-assign)
  username: "user",   // Optional authentication
  password: "pass",   // Optional authentication
});

Configuration options

port
number
default:"0"
The port number for the SMTP server. Use 0 to automatically assign an available port.
username
string
Username for SMTP authentication. If not provided, authentication is optional.
password
string
Password for SMTP authentication. Required if username is set.
The server automatically restarts when configuration changes are saved, applying the new settings immediately.

Server features

The SMTP server implementation provides:
server.ts:19-69
// Authentication methods supported
authMethods: ['CRAM-MD5', 'PLAIN', 'LOGIN']

// Maximum message size: 25MB
size: 25 * 1024 * 1024

// Optional authentication
authOptional: !options.username && !options.password

Catch-all

Accepts emails to any address, perfect for testing multiple recipients

No delivery

Emails are captured, not delivered, ensuring safe testing

Authentication

Optional SMTP authentication with multiple methods

Large messages

Supports messages up to 25MB in size

Special features

  • Rejection testing: Emails with addresses starting with reject will be rejected, allowing you to test error handling
  • Real-time updates: New emails appear instantly in the Yasumu interface
  • Event notifications: Desktop notifications when new emails arrive

Email management

View and manage captured emails through the email interface:

Listing emails

email.ts:36-45
const emails = await workspace.email.listEmails({
  skip: 0,
  take: 50,
  sort: 'desc',      // 'asc' or 'desc' by received time
  unread: true,      // Filter by read/unread status
  search: 'query',   // Search in subject, from, to, cc, and body
});
Search functionality includes:
  • Email subject
  • From address
  • To address
  • CC addresses
  • HTML body content
  • Plain text content

Email details

Each captured email includes complete information:
{
  id: "unique-email-id",
  subject: "Welcome to our service",
  from: "[email protected]",
  to: "[email protected]",
  cc: "[email protected]",
  bcc: "[email protected]",
  html: "<html>...</html>",
  text: "Plain text version",
  attachments: [...],
  unread: true,
  createdAt: "2024-01-15T10:30:00Z"
}
Rendered HTML emails with full styling and images

Email operations

// Get a specific email (marks as read by default)
const email = await workspace.email.getEmail(emailId);

// Get without marking as read
const email = await workspace.email.getEmail(emailId, false);

Automated email processing

Yasumu can automatically execute scripts when new emails arrive, enabling workflow automation:
email.service.ts:218-275
public async executeScript(
  workspaceId: string,
  emailOrId: EmailData | string,
) {
  // Scripts execute with full email context
  const context: EmailScriptContext = {
    workspace: { id, name, path },
    environment: activeEnvironment,
    email: emailData,
  };
}

Email script example

export function onEmail(email, env) {
  // Access email properties
  console.log('From:', email.from);
  console.log('Subject:', email.subject);
  
  // Parse email content
  const html = email.getHtml();
  const text = email.getText();
  
  // Extract verification codes, links, etc.
  const codeMatch = text.match(/code: (\d+)/);
  if (codeMatch) {
    // Save to environment for use in requests
    env.setVariable('verificationCode', codeMatch[1]);
  }
  
  // Process attachments
  for (const attachment of email.attachments) {
    console.log('Attachment:', attachment.filename);
  }
}
Email scripts run automatically when new emails arrive, perfect for extracting verification codes, magic links, or triggering follow-up requests.

Integration with your application

Configure your application to use Yasumu’s SMTP server:
const nodemailer = require('nodemailer');

const transporter = nodemailer.createTransport({
  host: 'localhost',
  port: 1025,
  auth: {
    user: 'user',  // If configured
    pass: 'pass',  // If configured
  },
  tls: {
    rejectUnauthorized: false
  }
});

Use cases

Registration testing

Test user registration flows and capture verification emails

Password resets

Verify password reset email delivery and extract reset tokens

Notification testing

Test notification emails without spamming real addresses

Template development

Develop and preview email templates in a safe environment

Multi-recipient testing

Test emails sent to multiple recipients without real delivery

Email automation

Extract data from emails and use in subsequent API requests
The SMTP server is for development and testing only. Do not use it in production or expose it to untrusted networks.

Build docs developers (and LLMs) love