MailHog

by mailhog

mailhog /MailHog

Web and API based SMTP testing

7.0K Stars 510 Forks Last release: about 2 months ago (v1.0.1) MIT License 288 Commits 26 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

MailHog Download GoDoc Build Status

Inspired by MailCatcher, easier to install.

  • Download and run MailHog
  • Configure your outgoing SMTP server
  • View your outgoing email in a web UI
  • Release it to a real mail server

Built with Go - MailHog runs without installation on multiple platforms.

Overview

MailHog is an email testing tool for developers:

  • Configure your application to use MailHog for SMTP delivery
  • View messages in the web UI, or retrieve them with the JSON API
  • Optionally release messages to real SMTP servers for delivery

Installation

Manual installation

Download the latest release for your platform. Then read the deployment guide for deployment options.

MacOS

brew update && brew install mailhog

Then, start MailHog by running

mailhog
in the command line.

Debian / Ubuntu

sudo apt-get -y install golang-go
go get github.com/mailhog/MailHog

Then, start MailHog by running

/path/to/MailHog
in the command line.

E.g. the path to Go's bin files on Ubuntu is

~/go/bin/
, so to start the MailHog run:
~/go/bin/MailHog

Docker

Run it from Docker Hub or using the provided Dockerfile

Configuration

Check out how to configure MailHog, or use the default settings: * the SMTP server starts on port 1025 * the HTTP server starts on port 8025 * in-memory message storage

Features

See MailHog libraries for a list of MailHog client libraries.

  • ESMTP server implementing RFC5321
  • Support for SMTP AUTH (RFC4954) and PIPELINING (RFC2920)
  • Web interface to view messages (plain text, HTML or source)
    • Supports RFC2047 encoded headers
  • Real-time updates using EventSource
  • Release messages to real SMTP servers
  • Chaos Monkey for failure testing
  • HTTP API to list, retrieve and delete messages
    • See APIv1 and APIv2 documentation for more information
  • HTTP basic authentication for MailHog UI and API
  • Multipart MIME support
  • Download individual MIME parts
  • In-memory message storage
  • MongoDB and file based storage for message persistence
  • Lightweight and portable
  • No installation required

sendmail

mhsendmail is a sendmail replacement for MailHog.

It redirects mail to MailHog using SMTP.

You can also use

MailHog sendmail ...
instead of the separate mhsendmail binary.

Alternatively, you can use your native

sendmail
command by providing
-S
, for example:
/usr/sbin/sendmail -S mail:1025

For example, in PHP you could add either of these lines to

php.ini
:
sendmail_path = /usr/local/bin/mhsendmail
sendmail_path = /usr/sbin/sendmail -S mail:1025

Web UI

Screenshot of MailHog web interface

Contributing

MailHog is a rewritten version of MailHog, which was born out of M3MTA.

Clone this repository to

$GOPATH/src/github.com/mailhog/MailHog
and type
make deps
.

See the Building MailHog guide.

Requires Go 1.4+ to build.

Run tests using

make test
or
goconvey
.

If you make any changes, run

go fmt ./...
before submitting a pull request.

Licence

Copyright ©‎ 2014 - 2017, Ian Kent (http://iankent.uk)

Released under MIT license, see LICENSE for details.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.