View on GitHub


Mail catcher for NodeJs

Download this project as a .zip file Download this project as a tar.gz file

Development email testing made easy

Capto runs a simple SMTP server that captures any message sent to it, persists it into a mongodb collection and displays it in a web interface. No messages are relayed to any email addresses. The backend is written in NodeJs using the Express framework and the frontend is driven by ExtJs 5.





Capto requires a MongoDB instance. If you wish to have full text search working, you will need to be running Mongo 2.6 or greater.

To get started, install capto (may require sudo privileges):

npm install -g capto

Change directory to the node modules directory:

cd /usr/local/lib/node_modules/capto/app/config/

Copy the settings.js.example to settings.js. Modify the settings to match your requirements

To run the HTTP and SMTP server with the default options:

capto run

There are a few options you can set:

  Usage: run [options]


    -h, --help                 output usage information
    --smtp-ip [address]        Set the ip address for the http server
    --http-ip [address]        Set the ip address for the smtp server
    --smtp-port [port]         Set the port of the smtp server
    --http-port [port]         Set the port of the http server
    --max-message-size [size]  Set the max message size the smtp server will accept in bytes

Now open: http://localhost:9024 to view the web interface. Send messages to smtp://

Please note: The max message size is 10mb. You can reduce this limit by setting the appropriate option either via the command line options or in the settings file

Configuring a mail library to send messages to capto


For use in Django, simply add the following configuration to your projects'

    EMAIL_HOST = ''
    EMAIL_PORT = 9025
    EMAIL_USE_TLS = False


Using Node mailer

var nodemailer = require('nodemailer');
var smtpTransport = require('nodemailer-smtp-transport');
var transporter = nodemailer.createTransport(smtpTransport({
  host: 'localhost',
  port: 9025,
  secure: false,
  debug: true,
  ignoreTLS: true


To set up your rails app, I recommend adding this to your environments/development.rb:

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { :address => "localhost", :port => 9025 }


All contributions and bug reports are very welcome!


The backend exposes a RESTful API:

Route Method Description
/messages GET Get all messages
/messages DELETE Delete all messages
/messages POST Create a message
/messages/{id} GET Get a single message
/messages/{id} DELETE Delete a message
/messages/{id}/source GET Get the source of a message
/messages/{id}/source.eml GET Download the source of a message
/messages/{id}/html GET Get the html of a message
/messages/{id}/source GET Get the plain text of a message
/messages/{id}/attachments/{attachmentId} GET Get an attachment (to download append ?download to the URL)
/messages/{id}/headers GET Get the headers for a message (for a html representation append ?html to the URL)


Many thanks to sj26 for his excellent mailcatcher project for the inspiration for this project.

Many thanks also goes to the many developers who have contributed to the various libraries used in this project.


GPLv3. See LICENSE file in the source.