MailDev

SMTP Server + Web Interface for viewing and testing emails during development.

Fork me on Github

MailDev is a simple way to test your projects' emails during development with an easy to use web interface that runs on your machine.

Test responsive emails

Toggle between formats

Find an email quickly

Features

  • Toggle between HTML, plain text views as well as view the source or email headers
  • Test Responsive Emails w/ resizeable preview pane available for 320/480/600px viewports
  • Receive and view email attachments
  • New emails appear instantly in interface when received (via Websockets)
  • Command line interface for configuring SMTP and Web interface ports
  • Ability to relay email to an upstream SMTP server (like Gmail)
  • Export .eml files

Install & Run

npm

With Node.js and npm installed, download, install and run MailDev:

  $ npm install -g maildev
  $ maildev

Docker

Using Docker to run the official MailDev image in a container. You may choose to change your port mapping or link containers together:

  $ docker pull djfarrelly/maildev
  $ docker run -p 1080:80 -p 1025:25 djfarrelly/maildev

From the source

You can also clone the source from GitHub and with Node.js

  $ git clone git@github.com:djfarrelly/MailDev.git
  $ npm install -g ./maildev
  $ maildev

Usage

On the command line:

  maildev [options]

    -h, --help              output usage information
    -V, --version           output the version number
    -s, --smtp [port]       SMTP port to catch emails [1025]
    -w, --web [port]        Port to run the Web GUI [1080]
    --outgoing-host [host]  SMTP host for outgoing emails
    --outgoing-port [port]  SMTP port for outgoing emails
    --outgoing-user [user]  SMTP user for outgoing emails
    --outgoing-pass [pass]  SMTP password for outgoing emails
    --outgoing-secure       Use SMTP SSL for outgoing emails
    -o, --open              Open the Web GUI after startup
    -v, --verbose

Or within your Node.js project:

  var MailDev = require('maildev');

  var maildev = new MailDev();

  // Handle new emails as they come in
  maildev.on('new', function(email){
    console.log('Received new email with subject: %s', email.subject);
  });

  // Get all emails
  maildev.getAllEmail(function(err, emails){
    if (err) return console.log(err);
    console.log('There are %s emails', emails.length);
  });

Configure your project

Configure your application to send emails via port 1025 and open localhost:1080.

Example Setups

  • Node — Nodemailer:
      var transport = nodemailer.createTransport({
        port: 1025,
        ignoreTLS: true,
        // other settings...
      });
    
  • Django — add EMAIL_PORT = 1025 in your settings file [source]
  • Rails — add the port to your config settings:
      config.action_mailer.delivery_method = :smtp
        config.action_mailer.smtp_settings = {
          :address => "localhost",
          :port => 1025
        }
    

Ideas, Issues or Contributions?

Have an idea or feature request? I would love to here it. Create an issue on github or contact me on twitter @djfarrelly

A list of all releases can be found in the changelog

Thanks to Andris Reinman for creating his projects that are the backbone of this app and MailCatcher for the inspiration.

MailDev is released under the MIT license