Web and API based SMTP testing

Related tags

Email MailHog
Overview

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.

Comments
  • Is this project dead?

    Is this project dead?

    Just wanted to ask for the project status, because there are so many open issues and pull requests. Last repository update was over a year ago...

    So is this project already dead? @ian-kent ?

    opened by EvilBMP 24
  • Add daemon option for Linux

    Add daemon option for Linux

    It would be nice to be able to run mailhog as a daemon in Linux. I think the original MailHog had a -daemon option or something like that, but for the current version, the only way to run it in the background is to use nohup or pipe things somehow.

    enhancement 
    opened by geerlingguy 17
  • can't configure to run on a https domain

    can't configure to run on a https domain

    I"m trying to run mailhog in openshift and have managed to get it mostly working.. smtp is working, but thw web ui isn't working, error is

     VM51:35 Mixed Content: The page at 'https://example.com/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://example.com/api/v2/websocket'. This request has been blocked; this endpoint must be available over WSS. VM51:35 Uncaught DOMException: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.(…) https://example.com/api/v2/jim Failed to load resource: the server responded with a status of 404 ()

    I tried setitng env

    MH_API_HOST=https://example.com/

    but its not being used in /

    source :

    var apiHost = "";
          if(apiHost.length > 0 && !endsWith(apiHost, "/")) {
            apiHost += "/";
          }
    
    
    opened by cameronbraid 14
  • Use official golang as base container

    Use official golang as base container

    Docker is already providing a well supported base image for Go apps. Those official images are also continuously maintained and scanned for security issues. Please note that this will also bump the version of Go to 1.9.3 and Alpine 3.6 (by the time of writing).

    btw: would be great if you could fullfil the steps to become an "official" image yourself. :)

    See also: https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/

    opened by J0WI 12
  • Attachements in Base64 are not downloaded correctly

    Attachements in Base64 are not downloaded correctly

    Excerpt from the source: ------=_Part_106_2085203044.1420709065643 Content-Type: application/pdf; name=2014826.001.pdf Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=2014826.001.pdf

    JVBERi0xLjQKJaqrrK0KNCAwIG9iago8PAovQ3JlYXRvciAoQXBhY2hlIEZPUCBWZXJzaW9uIDEu MSkKL1Byb2R1Y2VyIChBcGFjaGUgRk9QIFZlcnNpb24gMS4xKQovQ3JlYXRpb25EYXRlIChEOjIw MTUwMTA4MTAyNDI1KzAxJzAwJykKPj4KZW5kb2JqCjUgMCBvYmoKPDwKICAvTiAzCiAgL0xlbmd0 aCAxMSAwIFIKICAvRmlsdGVyIC9GbGF0ZURlY29kZQo+PgpzdHJlYW0KeJydlndUU9kWh8+9N71Q khCKlNBraFICSA29SJEuKjEJEErAkAAiNkRUcERRkaYIMijggKNDkbEiioUBUbHrBBlE1HFwFBuW SWStGd+8ee/Nm98f935rn73P3Wfvfda6AJD8gwXCTFgJgAyhWBTh58WIjYtnYAcBDPAAA2wA4HCz ...

    When Clicking the Download-Button it will just save the Base64 Characters in a textfile named 2014826.001.pdf and not create a valid pdf

    bug 
    opened by oers 11
  • Offer sendmail replacement

    Offer sendmail replacement

    I was looking into mailhog, but my application uses sendmail to send its mail. Any chance of adding a drop-in replacement for sendmail that would instead send its messages to mailhog? Or is this already possible and am I missing something (I am aware of the possibility of configuring sendmail to use smtp, but that seems quite involved and ultimately a roundabout way of getting an email from a command line utility into mailhog).

    enhancement 
    opened by eelkeblok 10
  • Underscores being interpreted as spaces (%20) in HTML body links.

    Underscores being interpreted as spaces (%20) in HTML body links.

    We are using Mailhog fairly extensively at work on test instances and members of development teams have been mentioning an issue with regards to underscores in links in the HTML body being wrongly interpreted as spaces.

    For example if the email body has a link email_activation it gets interpreted as email%20activation. This apparently happens for all links that use underscores as we also see this glitch with image names that contain underscores that then just 404.

    I hope this makes sense and if we need to investigate further I will involve some of my developer colleagues to shine some more light on this.

    bug 
    opened by rosstimson 9
  • IFRAME not taking all height on HTML mail preview

    IFRAME not taking all height on HTML mail preview

    IFRAME height defaults to browser default which is 150px on chrome and in effect mail preview is limited to a small scrollable stripe. My fix was to set IFRAME height to 100%.

    opened by nexces 9
  • Docker Hub

    Docker Hub

    Is the container for mailhog only has mailhog, does it also have mhsendmail or do i need to add mhsendmail, i try everything i can think, i even try to install on fpm and nginx.

    im not sure where I'm doing wrong.

    opened by benlumia007 8
  • PHP Configuration hints

    PHP Configuration hints

    I had loads of trouble trying to get MailHog (with or without mhsendmail) to work with php-fpm (MacOS, homebrew, php5.6, mailhog 0.2)

    I finally got it going with this in php.ini:

    sendmail_path = "/usr/local/bin/mailhog sendmail [email protected]"

    I can do a PR to add that simple recipe to the docs if you'll direct me where to put it.

    (I do see that hint in https://github.com/mailhog/mhsendmail/issues/3#issuecomment-127992203, which is where I got it, but that was closed.)

    opened by rfay 8
  • Provide a relative/local WebContext Path argument

    Provide a relative/local WebContext Path argument

    I tried to use Mailhog together with an apache-proxy.

    ProxyPass /mailhog http://localhost:8025/
    ProxyPassReverse /mailhog http://localhost:8025/
    

    Mailhog tries to resolve all resource absolute to the host:

    http://localhost/images/hog.png

    image

    I think mailhog needs an optional webcontext argument like -webcontext mailhog, which will then search all resources under /mailhog/.. instead of /

    enhancement 
    opened by oers 8
  • GitHub actions test/release process; build for more platforms

    GitHub actions test/release process; build for more platforms

    • Update builds to run with Go 1.19 and to use go modules for dependencies.
    • Setup build test in GitHub Actions instead of Travis.
    • Use GitHub Actions to build binaries automatically for releases upon tagging.
    • Add more platforms and arches to binary release process (for example, ARM64 platform).

    Should address https://github.com/mailhog/MailHog/issues/396, https://github.com/mailhog/MailHog/issues/307, https://github.com/mailhog/MailHog/issues/359

    opened by GUI 0
  • Latest versions of mailhog and mongodb incompatible (docker-compose)

    Latest versions of mailhog and mongodb incompatible (docker-compose)

    Replicate using this docker-compose.yml:

    version: "3.9"
    services:
      mailhog:
        image: "mailhog/mailhog:latest"
        ports:
        - "50001:8025"
        - "50002:1025"
        environment:
          MH_STORAGE: mongodb
          MH_MONGO_URI: "mongo:27017"
        depends_on:
        - mongo
    
      mongo:
        image: "mongo:latest"
    
    opened by barezina-intellipharm 0
  • Save emails/message for a time.

    Save emails/message for a time.

    Hi,

    Is it possbile to have the emails / messages saved for couple of weeks before delete? wondering about the In Memory storage option.

    How does the auto clean work, is there any time limit? Or storage limit?

    opened by ramialkaro 0
  • Feature Request: Separate Mailbox based on Mail Addresses

    Feature Request: Separate Mailbox based on Mail Addresses

    It would be nice to have a mailbox kind of thing in the web ui where mails would be grouped based on to or cc or bcc. So for example, Mails to [email protected] would be grouped in a mailbox. Mails where he is in recipient(in to, cc, bcc ) would be stored there.

    opened by hemel160238 0
Releases(v1.0.1)
Owner
MailHog
Web and API based SMTP testing
MailHog
Golang package for send email. Support keep alive connection, TLS and SSL. Easy for bulk SMTP.

Go Simple Mail The best way to send emails in Go with SMTP Keep Alive and Timeout for Connect and Send. IMPORTANT Examples in this README are for v2.2

Santiago De la Cruz 415 Jan 8, 2023
Lightweight SMTP client written in Go

Hectane Hectane is both a Go package providing an SMTP queue for sending emails and a standalone application that exposes this functionality via an HT

Hectane 221 Nov 23, 2022
MailHog SMTP Protocol

MailHog SMTP Protocol github.com/mailhog/smtp implements an SMTP server state machine. It attempts to encapsulate as much of the SMTP protocol (plus i

MailHog 74 Oct 27, 2022
:incoming_envelope: Simple email interface across multiple service providers (ses, postmark, mandrill, smtp)

go-mail Lightweight email package with multi-provider support (ses, mandrill, postmark) Table of Contents Installation Documentation Examples & Tests

MrZ 41 Dec 10, 2022
envio de email via SMTP com anexo usando Go

gosendmail - SMTP This repo is a simple net/smtp abstraction for sending emails using SMTP. With it we can send emails With copy, with blind copy and

Jefferson Otoni Lima 9 Aug 18, 2022
Disposable webmail server (similar to Mailinator) with built in SMTP, POP3, RESTful servers; no DB required.

Disposable webmail server (similar to Mailinator) with built in SMTP, POP3, RESTful servers; no DB required.

Inbucket 1.1k Jan 1, 2023
golang honeypot smtp server

honeygogo-smtp standalone honeypot A lightweight SMTP honeypot server written in Go, leveraging go-smtp. A stand alone version of a module from honeyg

jothflee 1 May 4, 2022
Simple tool to test SMTP mail send with various settings including TLS1.1 downgrade

smtptest Simple tool to test SMTP mail send with various settings including TLS1.1 downgrade All settings are configurable in the config.yaml file ser

Mario 1 Sep 19, 2022
Pretty wrapper for sending email using go net/smtp

Emailer A pretty wrapper around go net/smtp send multiple email using single client func main() { var client *emailer.Client var clientX sync.Mute

Vin. 1 Mar 23, 2022
BotHub - BotHub is a web-based robot editor built in go with support for go and python

Robot Simulator This is an application to simulate toy robot moving on a square

null 1 May 16, 2022
a simple api that sent spam via sms and email

a simple api that sent spam via sms and email routes: /sms /email example request with python

null 3 Oct 19, 2021
Go library for sending mail with the Mailgun API.

Mailgun with Go Go library for interacting with the Mailgun API. Usage package main import ( "context" "fmt" "log" "time" "githu

Mailgun Team 626 Dec 25, 2022
The Official Twilio SendGrid Led, Community Driven Golang API Library

NEW: Subscribe to email notifications for releases and breaking changes. The default branch name for this repository has been changed to main as of 07

Twilio SendGrid 872 Dec 15, 2022
A simple CSS parser and inliner in Go

douceur A simple CSS parser and inliner in Golang. Parser is vaguely inspired by CSS Syntax Module Level 3 and corresponding JS parser. Inliner only p

Aymerick 226 Dec 12, 2022
Robust and flexible email library for Go

email Robust and flexible email library for Go Email for humans The email package is designed to be simple to use, but flexible enough so as not to be

Jordan Wright 2.2k Dec 30, 2022
:inbox_tray: An IMAP library for clients and servers

go-imap An IMAP4rev1 library written in Go. It can be used to build a client and/or a server. Usage Client package main import ( "log" "github.com

Simon Ser 1.7k Jan 6, 2023
:envelope: A streaming Go library for the Internet Message Format and mail messages

go-message A Go library for the Internet Message Format. It implements: RFC 5322: Internet Message Format RFC 2045, RFC 2046 and RFC 2047: Multipurpos

Simon Ser 288 Dec 26, 2022
Using Mailchain, blockchain users can now send and receive rich-media HTML messages with attachments via a blockchain address.

Mailchain Introduction Mailchain enables blockchain-based email-like messaging with plain or rich text and attachment capabilities. Using blockchain p

Mailchain 133 Dec 28, 2022
High performance, self-hosted newsletter and mailing list manager with a modern dashboard. Single binary app.

listmonk is a standalone, self-hosted, newsletter and mailing list manager. It is fast, feature-rich, and packed into a single binary. It uses a Postg

Kailash Nadh 9.2k Dec 30, 2022