explaingit

sj26/mailcatcher

6,775RubyAudience · developerComplexity · 2/5Setup · easy

TLDR

A local fake SMTP server for developers that catches every email your app tries to send and displays it in a browser at localhost:1080, so you can test email sending without ever delivering a real message.

Mindmap

mindmap
  root((repo))
    What it does
      Fake SMTP server
      Web email viewer
      No real delivery
    Features
      HTML and text view
      Attachment display
      WebSocket live updates
    Install methods
      gem install
      Docker image
    Integrations
      Rails config
      PHP Django
      JSON API
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Test that your web app sends the correct transactional email by viewing caught messages at localhost:1080 during development.

USE CASE 2

Verify HTML email templates look right including both HTML and plain-text versions before going to production.

USE CASE 3

Automate email-sending tests by fetching caught messages as JSON from MailCatcher's built-in API.

USE CASE 4

Route PHP sendmail-based email through MailCatcher during development using the catchmail companion command.

Tech stack

RubyDockerSMTP

Getting it running

Difficulty · easy Time to first run · 5min

Install as a standalone gem outside your project Gemfile, adding it to Gemfile can cause dependency conflicts.

No license information was mentioned in the explanation.

In plain English

MailCatcher is a small tool for developers who need to test whether their app sends emails correctly, without those emails actually going anywhere. It runs a local fake email server on your computer. Your app sends mail to that fake server just like it would to a real one, and MailCatcher catches every message and displays it in a simple web page at http://127.0.0.1:1080. No email ever leaves your machine. This is useful during development because you can see exactly what the app is sending, including the HTML version, the plain text version, and any attachments, without worrying about accidentally emailing real people or filling up an inbox. New messages appear instantly if your browser supports WebSockets, otherwise the page refreshes every 30 seconds. Installing it takes one command: gem install mailcatcher (Ruby must already be installed). Then you run mailcatcher and point your app's email settings at localhost port 1025 instead of your normal mail server. The README includes specific configuration snippets for Rails, PHP, and Django. A Docker image is also available for people who prefer to run it in a container. The README explicitly advises against adding MailCatcher to your project's Gemfile, because it can conflict with other gems your application depends on. The recommended approach is to install it as a standalone gem outside your project's dependency list. A companion command called catchmail makes it easier to route PHP's sendmail-based mail through MailCatcher, since PHP normally calls an external binary rather than connecting to an SMTP server directly. MailCatcher also exposes a simple API so you can fetch message data as JSON programmatically, which can be useful for automated testing.

Copy-paste prompts

Prompt 1
I want to set up MailCatcher to test emails from my Rails app locally. What configuration do I add to my Rails environment file and how do I start MailCatcher?
Prompt 2
How do I configure my Django app to send mail to MailCatcher during development instead of a real SMTP server?
Prompt 3
I want to write an automated test that sends an email from my app and then asserts the subject and body using MailCatcher's JSON API. Show me how to fetch messages from that API.
Prompt 4
I use PHP with sendmail and want to route test emails through MailCatcher. How does the catchmail command work and how do I configure PHP to use it?
Open on GitHub → Explain another repo

← sj26 on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.