MailCatcher logo

MailCatcher

Capture and view outgoing email locally via a simple web UI

MailCatcher provides a lightweight SMTP server that intercepts emails and displays them instantly in a web interface, supporting HTML, plain text, attachments, and real‑time updates for development testing.

MailCatcher banner

Overview

Overview

MailCatcher runs a minimal SMTP server that captures every message sent to localhost:1025 and stores it for immediate inspection. A lightweight web interface (default http://127.0.0.1:1080) displays each email with rendered HTML, plain‑text fallback, source view, and downloadable attachments. Real‑time updates are pushed via WebSockets when the browser supports them, otherwise the UI polls every thirty seconds.

Getting Started & Integration

Install the gem (gem install mailcatcher) and start it with mailcatcher, or pull the Docker image sj26/mailcatcher and expose ports 1025 and 1080. Command‑line flags let you change IP addresses, ports, message limits, and run the process in the foreground or as a daemon. The tool ships with a catchmail wrapper for PHP mail() calls, and configuration snippets are provided for Rails, Django, and other frameworks. An HTTP‑based API offers JSON listings and endpoints for individual parts (/messages/:id.html, /messages/:id.plain, /messages/:id.source, etc.), making automated testing straightforward.

Highlights

Intercepts all outgoing mail via a local SMTP server
Web UI shows HTML, plain‑text and source with inline image rendering
Real‑time updates via WebSockets or periodic refresh
Command‑line options for IP, ports, message limits and daemon mode

Pros

  • Zero‑configuration start for local development
  • Works with Ruby, PHP, Python/Django, and other frameworks
  • Provides a simple REST‑like API for programmatic access
  • Lightweight and can run as a background daemon

Considerations

  • Not intended for production email routing
  • UTF‑8 encoding issues may require workarounds
  • No SMTP authentication or TLS support
  • Message storage is in‑memory and limited by the messages‑limit

Managed products teams compare with

When teams consider MailCatcher, these hosted platforms usually appear on the same shortlist.

Mailinator logo

Mailinator

Disposable email testing inboxes with public and private domains

Mailosaur logo

Mailosaur

Email & SMS testing with disposable inboxes and phone numbers

MailReach logo

MailReach

Email warm-up and spam testing to boost inbox placement

Looking for a hosted option? These are the services engineering teams benchmark against before choosing open source.

Fit guide

Great for

  • Testing email templates in Rails, Django, or PHP applications
  • QA teams needing to verify outbound email content without spamming real inboxes
  • Developers debugging SMTP delivery issues
  • CI pipelines that capture and assert email output

Not ideal when

  • Production email routing or high‑volume mail services
  • Environments requiring encrypted SMTP (TLS) or authentication
  • Scenarios needing persistent archival of all sent messages
  • Multi‑user shared testing where isolation is required

How teams use it

Rails development email preview

Developers see rendered email in the browser instantly, speeding up template iteration.

CI test suite email verification

Automated tests fetch messages via the API to assert subject, body, and attachments.

PHP application debugging

Catchmail redirects PHP mail() calls, allowing developers to view raw source and attachments.

Docker‑based local environment

Run MailCatcher container alongside services, exposing ports 1025/1080 for seamless integration.

Tech snapshot

Ruby67%
CoffeeScript18%
Sass10%
HTML4%
Dockerfile1%

Tags

developmentrailssmtpmaildevtoolsrubygemsserverruby

Frequently asked questions

How do I install MailCatcher?

Use `gem install mailcatcher` for the Ruby gem or pull the Docker image `sj26/mailcatcher` from Docker Hub.

Which ports does MailCatcher use?

By default SMTP listens on 1025 and the web UI on 1080; both can be changed with command‑line options.

Can I retrieve messages programmatically?

Yes, a REST‑like API provides JSON listings and endpoints for HTML, plain text, source, and attachments.

Does MailCatcher support TLS or authentication?

No, it is intended for local development and does not implement SMTP authentication or encryption.

How is message storage handled?

Messages are kept in memory up to the `--messages-limit` count; older messages are discarded when the limit is reached.

Project at a glance

Dormant
Stars
6,720
Watchers
6,720
Forks
596
LicenseMIT
Repo age15 years old
Last commit2 years ago
Primary languageRuby

Last synced 3 hours ago