Git Product home page Git Product logo

mailhog's Introduction

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 Go < v1.18

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

Go >= v1.17 (Debian Bookworm)

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

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

FreeBSD

pkg install mailhog
sysrc mailhog_enable="YES"
service mailhog start

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.

mailhog's People

Contributors

3alster avatar amayer5125 avatar anthonyptetlow avatar blueimp avatar bocharsky-bw avatar eirc avatar eliasp avatar espen avatar gedge avatar geerlingguy avatar gresau avatar ian-kent avatar j0wi avatar jamesvalleyt avatar juampynr avatar kkrauth avatar kraxx avatar lafentres avatar marcdeop avatar missedone avatar mkdgs avatar mtricht avatar nnmer avatar ntan-ebates avatar pmhausen avatar riking avatar rpkamp avatar schweinepriester avatar sdurrheimer avatar tyndyll avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mailhog's Issues

Feature Request: Save to directory

Possibility to save messages to a directory..

eg
-storage directory -directory /home/tests/mail/

Rationale, I want to go an investigate sent messages later, and having the messages in files would help

Sending from Gmail creates a panic

2014/07/20 16:36:03 Parsing MIME body
panic: runtime error: index out of range

looks like ParseMIMEBody() might be the reason, I commented out lines 62-65 in mailhog/data/message.go and the panics have stopped

smtp auth

Implement smtp auth and a config for smtp auth

MailHog stops responding after 250 Ok: queued as ... if eventstream disabled in browser

Have just been trialing MailHog. Very easy to get up and running!

When testing it out I was watching my Emails come through in the WebUI and clicked around some of the buttons. I noticed after clicking the toggle eventstream and it turning from green to red that after a couple more emails are sent the SMTP server stops responding to requests after the mail gets queued for delivery.

I've managed to reproduce using telnet. Steps to reproduce are:

  • Send a few messages and watch them appear in the web console
  • Toggle the eventviewer in the browser to off
  • Send a few more messages, usually after the 3rd or 4th message the server will stop responding to quit, or any other command for that matter. For example see below:
 telnet localhost 1025
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 mailhog.example ESMTP Go-MailHog
HELO test
250 Hello test
MAIL FROM:<[email protected]>
250 Sender [email protected] ok
RCPT TO:<[email protected]>
250 Recipient [email protected] ok
DATA
354 End data with <CR><LF>.<CR><LF>
Hello
.
250 Ok: queued as 54929b149a6dd2435200000b
quit
quit




quit

I've managed to reproduce it pretty reliably, everything works fine until I toggle the eventstream to off.

Panic when using -ui-bind-addr (flag redefined: listen)

Problem

I get panic when trying to override the UI or API bind address.

Version

v0.1.6 binary release

Trace:

$ ./MailHog_linux_amd64 -ui-bind-addr=":8026"

2015/03/27 13:10:47 Using in-memory storage
[HTTP] Binding to address: 0.0.0.0:8025
Creating API v1
Creating API v2
Starting application on 0.0.0.0:8025
[HTTP] Binding to address: :8026
./MailHog_linux_amd64 flag redefined: listen
panic: ./MailHog_linux_amd64 flag redefined: listen

goroutine 7 [running]:
flag.(*FlagSet).Var(0xc2080640c0, 0x7f6073a823c8, 0xc2080c0fc0, 0x8f59a0, 0x6, 0x99dd10, 0x36)
    /usr/local/Cellar/go/1.4/libexec/src/flag/flag.go:679 +0x494
flag.StringVar(0xc2080c0fc0, 0x8f59a0, 0x6, 0x0, 0x0, 0x99dd10, 0x36)
    /usr/local/Cellar/go/1.4/libexec/src/flag/flag.go:588 +0xce
github.com/ian-kent/gotcha/config.(*Config).flags(0xc20804f8b0)
    /Users/ikent/dev/src/github.com/ian-kent/gotcha/config/config.go:52 +0x7d
github.com/ian-kent/gotcha/config.Create(0x9e4d28, 0x449240)
    /Users/ikent/dev/src/github.com/ian-kent/gotcha/config/config.go:39 +0x224
github.com/ian-kent/gotcha/app.Create(0x9e4d28, 0x2)
    /Users/ikent/dev/src/github.com/ian-kent/gotcha/app/app.go:18 +0x28
github.com/mailhog/http.Listen(0x7fff87f6922b, 0x5, 0x9e4d28, 0xc2080643c0, 0x9e56c0)
    /Users/ikent/dev/src/github.com/mailhog/http/server.go:11 +0x14b
created by main.main
    /Users/ikent/dev/src/github.com/mailhog/MailHog/main.go:50 +0x316

goroutine 1 [chan receive]:
main.main()
    /Users/ikent/dev/src/github.com/mailhog/MailHog/main.go:56 +0x186

goroutine 6 [chan receive]:
github.com/mailhog/http.Listen(0x906110, 0xc, 0x9e4d28, 0xc2080643c0, 0x9e56b8)
    /Users/ikent/dev/src/github.com/mailhog/http/server.go:18 +0x1e6
created by main.main
    /Users/ikent/dev/src/github.com/mailhog/MailHog/main.go:49 +0x2c7

goroutine 8 [runnable]:
github.com/mailhog/MailHog-Server/smtp.Listen(0xc2080ba410, 0xc2080643c0, 0x9e4d28)
    /Users/ikent/dev/src/github.com/mailhog/MailHog-Server/smtp/smtp.go:11
created by main.main
    /Users/ikent/dev/src/github.com/mailhog/MailHog/main.go:52 +0x14a

goroutine 9 [runnable]:
github.com/mailhog/MailHog-Server/api.funcยท001()
    /Users/ikent/dev/src/github.com/mailhog/MailHog-Server/api/v1.go:66
created by github.com/mailhog/MailHog-Server/api.CreateAPIv1
    /Users/ikent/dev/src/github.com/mailhog/MailHog-Server/api/v1.go:77 +0x90c

goroutine 10 [runnable]:
github.com/ian-kent/gotcha/app.funcยท001()
    /Users/ikent/dev/src/github.com/ian-kent/gotcha/app/app.go:33
created by github.com/ian-kent/gotcha/app.(*App).Start
    /Users/ikent/dev/src/github.com/ian-kent/gotcha/app/app.go:38 +0x288

Table layout broken if subject ist too long

When you send/recevive an E-Mail with a very long subject/E-Mail-Adress the layout of the table will break:

  • content is not aligned with heading
  • horizontal scrollbar will not scroll to the right

This was on 1280x1024 screen. On a larger screen more content was visible, but the alignment was still broken.

image

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).

Open links in new window

Hi,

MailHog is awesome.

Quick issue/question - is there a way to force all email links to be opened in a new window?

When I'm viewing my emails - if I click on a link in the email it opens it within the MailHog tab - I'd rather it just open a new window so MailHog stays as it was?

HTML encoded Characters are not translated

HTML:

<html><body>Sehr geehrte Damen und Herren,<br />anbei erhalten Sie eine aut=
omatisch erzeugte Meldung einer Verkehrsbeschr=C3=A4nkung Baustellenmeldung=
 zur Baustelle M=C3=A4h im Stra=C3=9Fennetz.<br />Mit der Bitte um =
Kenntnisnahme verbleiben wir<br />mit freundlichen Gr=C3=BC=C3=9Fen,</body>=
</html>

will render as:

Sehr geehrte Damen und Herren,
anbei erhalten Sie eine aut= omatisch erzeugte Meldung einer Verkehrsbeschr=C3=A4nkung       Baustellenmeldung= zur Baustelle M=C3=A4h im Stra=C3=9Fennetz.
Mit der Bitte um = Kenntnisnahme verbleiben wir
mit freundlichen Gr=C3=BC=C3=9Fen,=

Doc Request: smtp forwarding and API V2

Let me start by saying I love mailhog. I just found it and got it up and running in no time. Great work! I'd like to take advantage of the feature to forward messages to an SMTP server, but I don't know how to set that up. I didn't see it in the CONFIG.md file. I don't know Go (I'm a Java dev), but I found the following snippet in the config.go file from the Server repo:

flag.StringVar(&cfg.OutgoingSMTPFile, "outgoing-smtp", envconf.FromEnvP("MH_OUTGOING_SMTP", "").(string), "JSON file containing outgoing SMTP servers")

So, I know I need a file with JSON, but what is the expected format?

Also, I noticed that when using the web client I could see the API calls to the server, which is cool, but I noticed that it uses v2. The docs are still for v1. I think I can get most of what I need from the server output, but I was wondering if there were other nuggets of gold I hadn't discovered. For example, the docs don't cover search requests, but I was able to see them when using the search feature in the UI.

If you could update the docs to include the above information, that would be awesome.

Thanks!

auth for mail release

There's no way to release mail via a smtp server that requires username/password.
Could you please add this?

Furthermore it would be great to specify default values for username/password/host/port via environment variables or command line options.

Failiures

This is a feature request as I am using to test a local email system, which is a webapp, with both qt/c++, mobile/phonegap and web interfaces...

Useful would be an option to make random or predictable failures happen, eg

  • wrong pass
  • wrong user
  • long lag
  • connection fail

This would be particularily useful to handle these errors on the client side..

-fails="all" (or credentials, lag, connect, et all)

Attachments - how to download them?

Hello,

I am attaching different files, as attachments, how I don't see anywhere in the UI, on where those attachments could be?

I see them in 'mimes', but when I try to download, they are not downloadable..

Thank you

CSS in HTMLย emails breaks layout

If there is some styling in HTML email regarding for example "body" element those styles are also applied to MailHog UI.
To avoid this kind of issues HTML preview could be presented in "iframe".

Message list sorting

I've got currently 30 messages stored in mongodb and it seems that they are sorted mostly* by mongo internal _id field and not by date.

* take a look at _id of first message

Here is sample:

> db.messages.find({},{created:1})
{ "_id" : ObjectId("54b8e23dae8939e356b486f4"), "created" : ISODate("2015-01-16T10:04:45.464Z") }
{ "_id" : ObjectId("54aceb9001f053f503b6d55f"), "created" : ISODate("2015-01-07T08:17:20.012Z") }
{ "_id" : ObjectId("54aceb9101f053f503b6d560"), "created" : ISODate("2015-01-07T08:17:21.867Z") }
{ "_id" : ObjectId("54b8c4f0ae8939e356b486ed"), "created" : ISODate("2015-01-16T07:59:44.244Z") }
{ "_id" : ObjectId("54b8c4f1ae8939e356b486ee"), "created" : ISODate("2015-01-16T07:59:45.373Z") }
{ "_id" : ObjectId("54b8d3c7ae8939e356b486ef"), "created" : ISODate("2015-01-16T09:03:03.230Z") }
{ "_id" : ObjectId("54b8d3c8ae8939e356b486f0"), "created" : ISODate("2015-01-16T09:03:04.200Z") }
{ "_id" : ObjectId("54b8deb7ae8939e356b486f1"), "created" : ISODate("2015-01-16T09:49:43.142Z") }
{ "_id" : ObjectId("54b8deb8ae8939e356b486f2"), "created" : ISODate("2015-01-16T09:49:44.160Z") }
{ "_id" : ObjectId("54b8e23dae8939e356b486f3"), "created" : ISODate("2015-01-16T10:04:45.385Z") }
{ "_id" : ObjectId("54bcc3834a22d404b713168c"), "created" : ISODate("2015-01-19T08:42:43.207Z") }
{ "_id" : ObjectId("54bcc3844a22d404b713168d"), "created" : ISODate("2015-01-19T08:42:44.352Z") }
{ "_id" : ObjectId("54bcd8904a22d404b713168e"), "created" : ISODate("2015-01-19T10:12:32.014Z") }
{ "_id" : ObjectId("54bcd8904a22d404b713168f"), "created" : ISODate("2015-01-19T10:12:32.940Z") }
{ "_id" : ObjectId("54bd10684a22d404b7131690"), "created" : ISODate("2015-01-19T14:10:47.995Z") }
{ "_id" : ObjectId("54bd10684a22d404b7131691"), "created" : ISODate("2015-01-19T14:10:48.887Z") }
{ "_id" : ObjectId("54bd10f64a22d404b7131692"), "created" : ISODate("2015-01-19T14:13:10.700Z") }
{ "_id" : ObjectId("54bd10f74a22d404b7131693"), "created" : ISODate("2015-01-19T14:13:11.621Z") }
{ "_id" : ObjectId("54cb66fab2c2f2eb6bfaa07a"), "created" : ISODate("2015-01-30T11:11:54.303Z") }
{ "_id" : ObjectId("54cb6821b2c2f2eb6bfaa07b"), "created" : ISODate("2015-01-30T11:16:49.296Z") }
{ "_id" : ObjectId("54dc743b78319c46012e3c10"), "created" : ISODate("2015-02-12T09:36:59.434Z") }
{ "_id" : ObjectId("54dc743b78319c46012e3c11"), "created" : ISODate("2015-02-12T09:36:59.582Z") }
{ "_id" : ObjectId("54c0c7a1bb2180ce176bec27"), "created" : ISODate("2015-01-22T09:49:21.261Z") }
{ "_id" : ObjectId("54c0c7a2bb2180ce176bec28"), "created" : ISODate("2015-01-22T09:49:22.768Z") }
{ "_id" : ObjectId("54c0c87bbb2180ce176bec29"), "created" : ISODate("2015-01-22T09:52:59.805Z") }
{ "_id" : ObjectId("54c0c87cbb2180ce176bec2a"), "created" : ISODate("2015-01-22T09:53:00.741Z") }
{ "_id" : ObjectId("54c0fe5dbb2180ce176bec2b"), "created" : ISODate("2015-01-22T13:42:53.476Z") }
{ "_id" : ObjectId("54c0fe5ebb2180ce176bec2c"), "created" : ISODate("2015-01-22T13:42:54.466Z") }
{ "_id" : ObjectId("54d1e5e3ebd97577889ba0c6"), "created" : ISODate("2015-02-04T09:26:59.673Z") }
{ "_id" : ObjectId("54d1e5e4ebd97577889ba0c7"), "created" : ISODate("2015-02-04T09:27:00.894Z") }
> db.messages.find({},{created:1}).count()
30

However applying simple sort on created field is not that simple as mongo is crying about exceeding buffered data limit.

> db.messages.find({},{created:1}).sort({created:1})
error: {
        "$err" : "Runner error: Overflow sort stage buffered data usage of 34342473 bytes exceeds internal limit of 33554432 bytes",
        "code" : 17144
}

Creating additional index fixes that:

> db.messages.ensureIndex({created:1})
{
        "createdCollectionAutomatically" : false,
        "numIndexesBefore" : 1,
        "numIndexesAfter" : 2,
        "ok" : 1
}
> db.messages.find({},{created:1}).sort({created:1})
{ "_id" : ObjectId("54aceb9001f053f503b6d55f"), "created" : ISODate("2015-01-07T08:17:20.012Z") }
{ "_id" : ObjectId("54aceb9101f053f503b6d560"), "created" : ISODate("2015-01-07T08:17:21.867Z") }
{ "_id" : ObjectId("54b8c4f0ae8939e356b486ed"), "created" : ISODate("2015-01-16T07:59:44.244Z") }
{ "_id" : ObjectId("54b8c4f1ae8939e356b486ee"), "created" : ISODate("2015-01-16T07:59:45.373Z") }
{ "_id" : ObjectId("54b8d3c7ae8939e356b486ef"), "created" : ISODate("2015-01-16T09:03:03.230Z") }
{ "_id" : ObjectId("54b8d3c8ae8939e356b486f0"), "created" : ISODate("2015-01-16T09:03:04.200Z") }
{ "_id" : ObjectId("54b8deb7ae8939e356b486f1"), "created" : ISODate("2015-01-16T09:49:43.142Z") }
{ "_id" : ObjectId("54b8deb8ae8939e356b486f2"), "created" : ISODate("2015-01-16T09:49:44.160Z") }
{ "_id" : ObjectId("54b8e23dae8939e356b486f3"), "created" : ISODate("2015-01-16T10:04:45.385Z") }
{ "_id" : ObjectId("54b8e23dae8939e356b486f4"), "created" : ISODate("2015-01-16T10:04:45.464Z") }
{ "_id" : ObjectId("54bcc3834a22d404b713168c"), "created" : ISODate("2015-01-19T08:42:43.207Z") }
{ "_id" : ObjectId("54bcc3844a22d404b713168d"), "created" : ISODate("2015-01-19T08:42:44.352Z") }
{ "_id" : ObjectId("54bcd8904a22d404b713168e"), "created" : ISODate("2015-01-19T10:12:32.014Z") }
{ "_id" : ObjectId("54bcd8904a22d404b713168f"), "created" : ISODate("2015-01-19T10:12:32.940Z") }
{ "_id" : ObjectId("54bd10684a22d404b7131690"), "created" : ISODate("2015-01-19T14:10:47.995Z") }
{ "_id" : ObjectId("54bd10684a22d404b7131691"), "created" : ISODate("2015-01-19T14:10:48.887Z") }
{ "_id" : ObjectId("54bd10f64a22d404b7131692"), "created" : ISODate("2015-01-19T14:13:10.700Z") }
{ "_id" : ObjectId("54bd10f74a22d404b7131693"), "created" : ISODate("2015-01-19T14:13:11.621Z") }
{ "_id" : ObjectId("54c0c7a1bb2180ce176bec27"), "created" : ISODate("2015-01-22T09:49:21.261Z") }
{ "_id" : ObjectId("54c0c7a2bb2180ce176bec28"), "created" : ISODate("2015-01-22T09:49:22.768Z") }
{ "_id" : ObjectId("54c0c87bbb2180ce176bec29"), "created" : ISODate("2015-01-22T09:52:59.805Z") }
{ "_id" : ObjectId("54c0c87cbb2180ce176bec2a"), "created" : ISODate("2015-01-22T09:53:00.741Z") }
{ "_id" : ObjectId("54c0fe5dbb2180ce176bec2b"), "created" : ISODate("2015-01-22T13:42:53.476Z") }
{ "_id" : ObjectId("54c0fe5ebb2180ce176bec2c"), "created" : ISODate("2015-01-22T13:42:54.466Z") }
{ "_id" : ObjectId("54cb66fab2c2f2eb6bfaa07a"), "created" : ISODate("2015-01-30T11:11:54.303Z") }
{ "_id" : ObjectId("54cb6821b2c2f2eb6bfaa07b"), "created" : ISODate("2015-01-30T11:16:49.296Z") }
{ "_id" : ObjectId("54d1e5e3ebd97577889ba0c6"), "created" : ISODate("2015-02-04T09:26:59.673Z") }
{ "_id" : ObjectId("54d1e5e4ebd97577889ba0c7"), "created" : ISODate("2015-02-04T09:27:00.894Z") }
{ "_id" : ObjectId("54dc743b78319c46012e3c10"), "created" : ISODate("2015-02-12T09:36:59.434Z") }
{ "_id" : ObjectId("54dc743b78319c46012e3c11"), "created" : ISODate("2015-02-12T09:36:59.582Z") }

Due to bug #34 preferred way of sorting would be newest first, but some sorting buttons over message list would also do the trick.

Duplicate Content-Disposition Header on File Download

When trying to download an attached file I get an error about duplicate Content-Disposition headers. Using curl I get this:

curl -v http://localhost:8025/api/v1/messages/[email protected]/mime/part/2/download -o /tmp/test.pdf
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying ::1...
* Connected to localhost (::1) port 8025 (#0)
> GET /api/v1/messages/[email protected]/mime/part/2/download HTTP/1.1
> Host: localhost:8025
> User-Agent: curl/7.42.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Disposition: attachment; filename="y7BMbIFKdxn05pFmZRKNKd74z6QgScJdnKYyndNcCFQ=@mailhog.example-part-2"
< Content-Disposition: inline; filename="picklist_145000114.pdf"
< Content-Transfer-Encoding: base64
< Content-Type: application/pdf
< Date: Thu, 30 Apr 2015 13:39:23 GMT
< Transfer-Encoding: chunked
< 
{ [16057 bytes data]
100 1509k    0 1509k    0     0  20.9M      0 --:--:-- --:--:-- --:--:-- 21.0M
* Connection #0 to host localhost left intact

The returned file seems to be correct, but browsers like Chrome and Firefox don't accept it because the headers are broken ;-(

Mega Project

MaiHog is one part of the equation of using email..

A full circle would be to make "MailKit", and "mailhog" as a part of a full loop test env

  • click a button and send a pass works
  • a creation of account, and send email
  • fabricate smtp logins for mobile,
  • manage the postfix pretend server
  • check vaction messages, and manage forwardings
  • serialise emails to actuals files, like real postfix/dovecot
  • simulate span and doss
  • send mailings and in control of process
  • create mailers, and newsgroups with easy opins outs
  • focus on coporate client chain, and templates with const data
  • mobile and tablet results,
  • caching..
  • the new cpanel for email
  • rest interface for admin mailserver, forwardings and vatatins and mega issues

Web UI - Authentification

Hi,

Is there currently a way to have an authentification (at least Basic Auth) for the UI?

Thanks.

some escaping issue?

Hello again :)

I have spotted one more problem.
For example I get this email to mailhog:

to reset your password, please click <a href=3D"http://sentinel=
.app/change_password/13/2eVJjEic4h5oui6h2lJ8gzl9mdC4qzXQ">this link.</a>.=

it is the source. the soruce itself is the same in both mailcatcher and mailhog, but the HTML rendered in mailhog is currupt.

For example link ir not change_password but change password (without underscore)

Here are the headers from mailhog:

Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=utf-8
Date: Mon, 04 May 2015 09:53:14 +0000
From: CRM <[email protected]>
MIME-Version: 1.0
Message-ID: [email protected]
Received: from sentinel.app by mailhog.example (Go-MailHog)
          id [email protected]; Mon, 04 May 2015 12:53:14 +0300
Return-Path: <[email protected]>
Subject: Reset your account password.
To: [email protected]

Here are the headers from mailcatcher:

Message-ID: <[email protected]>
Date: Mon, 04 May 2015 09:53:40 +0000
Subject: Reset your account password.
From: CRM <[email protected]>
To: [email protected]
MIME-Version: 1.0
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Not sure what else I can post :(

Thanks!

Update README, ie the tin

Mailhog lacks the "description" of what it does (what it says on the tin)

Please add

  • MailHog is for developers wanting to test send SMTP mailing code
  • Without accidentally emailing everyone on the lists..
  • Your can send email to MailHog and and will react like an smtp
  • But u can also readmails thru web interface.. useful for designers..
  • Its inspired and a rip off mailcatcher, a python service..

MailHog runs a super simple SMTP server which catches any message sent to it to display in a web interface. Run MailHog , set your favourite app to deliver to smtp://127.0.0.1:1025 instead of your default SMTP server, then check out http://127.0.0.1:1080 to see the mail that's arrived so far.

Just the way I see it..

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

Unrecognised command "MAIL FROM:<[address]>"

When I try to use MailHog in a Zend Framework 1 Application via SMTP, I get an exception with the message "Unrecognised command". After sone debugging I found the SMTP-command "MAIL FROM:<[e-mail-address]>" responsible for the exception.

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.

multipart boundaries

There seems to be a problem with multipart boundaries.

The mail is sent from an Oxid E-Shop using the PHPMailer library and it works on postfix/dovecot and mailcatcher without errors.

Excerpt:

Message-ID: <d6bf06db17fada1a3a8e3a8fab3c83f0@localhost>
MIME-Version: 1.0
Content-Type: multipart/alternative;
    boundary="b1_d6bf06db17fada1a3a8e3a8fab3c83f0"


--b1_d6bf06db17fada1a3a8e3a8fab3c83f0
Content-Type: text/plain; charset = "UTF-8"
Content-Transfer-Encoding: 8bit

2014/11/11 10:27:31 Found invalid header: ' boundary="b1_d6bf06db17fada1a3a8e3a8fab3c83f0"'
2014/11/11 10:27:31 Parsing MIME body
2014/11/11 10:27:31 Boundary not found: %!s(MISSING)
panic: runtime error: index out of range

goroutine 30 [running]:
runtime.panic(0x851f00, 0xb2afdc)
    /usr/local/Cellar/go/1.3.1/libexec/src/pkg/runtime/panic.c:279 +0xf5
github.com/ian-kent/Go-MailHog/mailhog/data.(*Content).ParseMIMEBody(0xc2080b0390, 0x11)
    /Users/ikent/dev/src/github.com/ian-kent/Go-MailHog/mailhog/data/message.go:90 +0x577
github.com/ian-kent/Go-MailHog/mailhog/data.ParseSMTPMessage(0xc20801b680, 0x8e4310, 0xf, 0x5)
    /Users/ikent/dev/src/github.com/ian-kent/Go-MailHog/mailhog/data/message.go:63 +0x3ad
github.com/ian-kent/Go-MailHog/mailhog/smtp.(*Session).Parse(0xc2080c23c0)
    /Users/ikent/dev/src/github.com/ian-kent/Go-MailHog/mailhog/smtp/session.go:86 +0x350
...
github.com/ian-kent/Go-MailHog/mailhog/smtp.StartSession(0xc20803a1e8, 0xc208070380)
    /Users/ikent/dev/src/github.com/ian-kent/Go-MailHog/mailhog/smtp/session.go:42 +0x190
created by main.smtp_listen
    /Users/ikent/dev/src/github.com/ian-kent/Go-MailHog/main.go:125 +0x42e

I put the whole shell output into a gist, hope it helps you to fix this.

https://gist.github.com/schaebo/d7c3fd3b32a4dbe5a024

Thanks for your work. Go-MailHog is a really useful and awesome piece of software and I do like the approach of not having to install a shitload of dependencies with it.

Greetings,
schaebo

html email rendering as plain text

When MailHog receives an email, which is html, it renders it as "plain text". I don't know why this happens, and how to render it as html.

Here is an example of part of the headers, as well as a screenshot:

Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=utf-8 

selection_218

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 /

fix for issue #42 seems to have broken this

I get the following when trying to install on a new system:

github.com/mailhog/MailHog

github.com/mailhog/MailHog/main.go:42: cannot use cb (type func("net/http".Handler)) as type func(_app.App) in argument to "github.com/mailhog/http".Listen
github.com/mailhog/MailHog/main.go:51: cannot use cb1 (type func("net/http".Handler)) as type func(_app.App) in argument to "github.com/mailhog/http".Listen
github.com/mailhog/MailHog/main.go:52: cannot use cb2 (type func("net/http".Handler)) as type func(*app.App) in argument to "github.com/mailhog/http".Listen

verbose logging using docker image

Loving the project!

Is there a way to make docker image not to print content of attachments into the logs? as it gets very verbose with bigger attachments.

Compile ERROR

main.go:5:2: cannot find package "github.com/ian-kent/MailHog/mailhog/config" in any of:
    /usr/local/go/src/pkg/github.com/ian-kent/MailHog/mailhog/config (from $GOROOT)
    /Users/bom_d_van/Code/go/workspace/src/github.com/ian-kent/MailHog/mailhog/config (from $GOPATH)
main.go:6:2: cannot find package "github.com/ian-kent/MailHog/mailhog/http" in any of:
    /usr/local/go/src/pkg/github.com/ian-kent/MailHog/mailhog/http (from $GOROOT)
    /Users/bom_d_van/Code/go/workspace/src/github.com/ian-kent/MailHog/mailhog/http (from $GOPATH)
main.go:7:2: cannot find package "github.com/ian-kent/MailHog/mailhog/smtp" in any of:
    /usr/local/go/src/pkg/github.com/ian-kent/MailHog/mailhog/smtp (from $GOROOT)
    /Users/bom_d_van/Code/go/workspace/src/github.com/ian-kent/MailHog/mailhog/smtp (from $GOPATH)
main.go:8:2: cannot find package "github.com/ian-kent/MailHog/mailhog/storage" in any of:
    /usr/local/go/src/pkg/github.com/ian-kent/MailHog/mailhog/storage (from $GOROOT)
    /Users/bom_d_van/Code/go/workspace/src/github.com/ian-kent/MailHog/mailhog/storage (from $GOPATH)

Install Issues

I just updated the project..

And the auth bug still not working..

But also a major restructure and now a makefile..

Can we put a bit more info.. on this make stuff

I was expecting to run
cd ~src/giithub.com... hog..
and then
go run main.go

I dont like makefile.. I want
go run main.go

What I am getting down to is that now its looks like all little projects..
which is good, lets go for it..
But out of the box, we dont want make imho..
This aint gonna run on windows and part of my "sales pitch"
is go.. ie no make.. (am trying to wean old c/c++ and c# coders)

get the drift..
does it make sense..
its a makeFile.. "Wtf is a makefile and how do I use it said le windows coder on her xp ?"
WindowsFileTranslation I replied, and then explain windows.. vs make

anyway...
minor point trying 2 make
only cos its neat and works for me and thanks Ian ;-) and all

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.

Docker image isn't updated automatically

I installed the latest Docker image assuming it would contain the latest version of MailHog, however it doesn't. This is probably due how the project has been setup over multiple GitHub projects. Docker Hub only allows you to watch a single GitHub project so if a fix is done inside of one of the other projects and no changes are required in the main project, the docker image won't be rebuilt.

An easy fix is to have some kind of version information somewhere in the main repository so that it is registered as a change. Because in other issues you mention version 0.1.3 which would contain the fix for HTML mail. But there is no file in the main repository that mentions this version number (or 0.1.1 and 0.1.2). After creating my own image with the Dockerfile the HTML issue is BTW fixed.

Enhancement Request - Auto forwarding of all emails to an SMTP server

I would love to have an option to have all emails forwarded to an SMTP server. I was thinking of something like using command-line options as such:

Mailhog -outgoing-smtp smtpServer -auto-forward TestServer

This would require the contents of smtpServer to look something like:
{
"TestServer": {
"Name": "TestServer",
"Save": true,
"Email": "[email protected]",
"Host": "webmail.emailAddr.com",
"Port": "25",
"Username": "",
"Password": "",
"Mechanism": "PLAIN"
}
}

The auto-forward would require a server from the provided config. You could require that there be an email address provided in the server given to the auto-forward option, and default save to true. If you want to go crazy, you could use the recipient of the email sent to mailhog and if there's a server in the config that matches that address, it would automatically forward there. In this case you could eliminate the server name from the auto-forward argument and just default to the first server in the list if the email address doesn't match any of them.

My use case is that I have several environments I want to run automation against, so I want mailhog to run on each box and keep emails in memory. This eliminates the need for a central mail server or running heavy mail servers on each box. However, I want to keep a longer-lasting record so we can look back at emails from a central place that users can access via Thunderbird or SquirrelMail, as we have many different levels of user. If that server is down, our automation can at least run and pass. Right now we're tied to the central server, which gives us a single point of failure, so using mailhog as a pass-through with a local copy would solve our problems.

Message list is not scrollable

Applying "overflow: auto" on "body > div > div > div.col-md-10.content" allow for message list to be scrolled but it doesn't solve problem all the way as the last message is still not visible.

Message sorting in UI

See #35 - add support for message sorting in MailHog UI (and related changes to in memory and mongo storage)

Broken pipe when attempting to send email

I love this server, but unfrotunately it's not working for me. It works fine when sending messages from jenkins' regular email program, but I get this error when I attemp to send them from the extended email plugin. (and, since I'm just a user and know next to nothing about stmp, not sure how to troubleshoot). It would be helpful if the mailhog logs had a debug setting so I could see why it's closing the connection.

javax.mail.MessagingException: Can't send command to SMTP host;
nested exception is:
java.net.SocketException: Broken pipe
at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:2106)
at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:2093)
at com.sun.mail.smtp.SMTPTransport.close(SMTPTransport.java:1184)
at javax.mail.Transport.send0(Transport.java:197)
at javax.mail.Transport.send(Transport.java:124)
at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:306)
at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:281)
at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:233)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:772)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:736)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.cleanUp(MavenModuleSetBuild.java:1064)

Multiple receivers

Hi,
I don't know if that is a bug, but I noticed that the UI is only displaying the last email address when the email has multiple receivers on field 'to'.

Also, congrats for the great job on MailHog!

Thanks!

MailHog sendmail not working as expected

I have a MailHog daemon running with default options.
I'm currently trying to use MailHog sendmail <email addr> to send a mail to MailHog.
(Later, my goal is to set PHPs sendmail_path = "/path/to/MailHog sendmail".)

However, this does not work as expected. MailHog sendmail is always trying to bind to localhost:1025, which is already used by the MailHog daemon.

When I try using the separate mhsendmail binary, then it works just fine. So either I haven't understood the concept, or something is going wrong...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.