# MailDev — SMTP Server and Web UI for Email Testing > A local SMTP server with a web interface for viewing and testing emails during development, eliminating the need to send real emails while building applications. ## Install Save as a script file and run: # MailDev — SMTP Server and Web UI for Email Testing ## Quick Use ```bash # Run with Docker docker run -p 1080:1080 -p 1025:1025 maildev/maildev # Or install globally via npm npm install -g maildev && maildev # Point your app's SMTP to localhost:1025, view emails at http://localhost:1080 ``` ## Introduction MailDev is a lightweight SMTP server with a built-in web interface designed for email testing during development. Instead of configuring real SMTP servers or risking accidental email delivery, developers point their application at MailDev and instantly view all outgoing emails in a browser, complete with HTML rendering, plain text, headers, and attachments. ## What MailDev Does - Runs a local SMTP server that captures all outgoing emails without delivering them - Provides a web UI to browse, search, and inspect captured emails - Renders HTML emails, plain text, and displays raw headers and source - Shows email attachments with download links - Exposes a REST API for programmatic access to captured emails in test suites ## Architecture Overview MailDev runs a Node.js-based SMTP server (using the smtp-server package) on a configurable port (default 1025). Every email sent to this server is captured in memory and made available through both a web interface (default port 1080) and a REST API. The web UI is a single-page application that auto-refreshes when new emails arrive via WebSocket. Emails can optionally be relayed to a real SMTP server for selective forwarding. ## Self-Hosting & Configuration - Run via Docker: `docker run -p 1080:1080 -p 1025:1025 maildev/maildev` - Or install via npm: `npm install -g maildev` - Configure your application's SMTP host to localhost and port to 1025 - Use `--smtp` and `--web` flags to customize ports - Set `--outgoing-host` and `--outgoing-user` to relay specific emails to a real SMTP server ## Key Features - Zero-configuration setup: run one command and start catching emails - Web interface with real-time updates via WebSocket - REST API for integration with automated test suites (GET /email, DELETE /email/all) - SMTP authentication support for testing auth-required email flows - Docker image available for consistent CI/CD pipeline integration ## Comparison with Similar Tools - **Mailpit** — Newer Go-based alternative with a modern UI and lower resource usage - **MailHog** — Similar concept but no longer actively maintained; MailDev is actively updated - **Ethereal** — Nodemailer's disposable email service; MailDev runs locally with no external dependency - **Mailtrap** — Commercial SaaS for email testing; MailDev is free, open source, and self-hosted - **Papercut** — Windows-focused SMTP test server; MailDev is cross-platform ## FAQ **Q: Will MailDev send real emails?** A: No. By default, MailDev captures all emails and never delivers them. You can optionally configure relay forwarding for specific messages. **Q: Can I use MailDev in CI/CD pipelines?** A: Yes. Run the Docker container in your CI environment and use the REST API to verify emails sent during integration tests. **Q: Does MailDev support HTML email rendering?** A: Yes. The web UI renders HTML emails in an iframe and also shows the raw HTML source and plain text alternatives. **Q: What license does MailDev use?** A: MIT License. ## Sources - https://github.com/maildev/maildev - https://maildev.github.io/maildev --- Source: https://tokrepo.com/en/workflows/asset-9e43a243 Author: Script Depot