Introducing Go-MailHog

Go-MailHog is a lightweight portable application which acts like a SMTP server.

It was inspired by MailCatcher, and does almost exactly the same thing, but without the slow and painful installation you get with Python Ruby.

| edit: it was Ruby, not Python – but painful nonetheless!

It was originally written in Perl based on code from M3MTA, but it’s been rewritten in Go for portability, and now runs on any supported platform without installation.

MailHog is designed for testing emails during application development. Instead of using a real SMTP server which delivers messages or has strict rules on email recipients, you can use MailHog and send messages to any email address with a valid format.

Instead of delivering the messages, they’re stored in MongoDB (edit: or memory!), and you can view them using the MailHog web interface, or retrieve them using an API for automated testing.

Using MailHog is as simple as downloading the binary release from GitHub and running it.

With no configuration, it will listen on port 1025 for SMTP, 8025 for HTTP (both web and API), and will connect to MongoDB running on localhost port 27017.

To view messages, point your browser at http://localhost:8025 or send a GET request to http://localhost:8025/api/v1/messages.

MailHog

Bookmark and Share

4 Responses

  1. Vince April 22, 2014 / 8:13 pm

    Hi,

    This looks interesting (tho I find no reason not to run MailCatcher really). A couple of points:

    MaiLCatcher is written in Ruby not Python
    The dependency on MongoDB is a turn off for me. MailCatcher just stores the emails on the filesystem.

    Other than that, it’s always nice to have alternatives!

    • Ian Kent May 14, 2014 / 10:07 pm

      Thanks :)

      MailHog doesn’t rely on MongoDB anymore though, by default it keeps messages in memory (I quickly found out how annoying that dependency was, but no filesystem support yet!)

      It’s still a work in progress though, so any feedback is welcome :)

      Mailcatcher is good, but installation just takes too long – it has so many dependencies on top of a clean Ubuntu/CentOS install it took around 30 minutes, nearly doubling the time it was taking to build a clean development environment.

  2. Stephane Wirtel April 24, 2014 / 11:26 am

    Hi,

    FYI, Mailcatcher uses Ruby and not Python.

    Could you fix your article?

    Thank you in advance.

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>