From 9dc6ad8ed404efc048f683a747c317ff8a0a99ae Mon Sep 17 00:00:00 2001 From: Ian Kent Date: Tue, 26 May 2015 22:58:57 +0100 Subject: [PATCH] Make `MailHog sendmail` a shortcut to `mhsendmail` for #45 --- Makefile | 1 + README.md | 10 ++++++++++ main.go | 11 +++++++++++ 3 files changed, 22 insertions(+) diff --git a/Makefile b/Makefile index 407dac2..490a71a 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ fmt: deps: go get github.com/mailhog/MailHog-Server go get github.com/mailhog/MailHog-UI + go get github.com/mailhog/mhsendmail cd ../MailHog-UI; make bindata go get github.com/mailhog/http go get github.com/ian-kent/go-log/log diff --git a/README.md b/README.md index c65599f..95acf55 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,16 @@ MailHog is an email testing tool for developers: * Lightweight and portable * No installation required +#### sendmail + +[mhsendmail](https://github.com/mailhog/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. + +#### Web UI + ![Screenshot of MailHog web interface](/docs/MailHog.png "MailHog web interface") ### Contributing diff --git a/main.go b/main.go index 2a33b5f..6f74d52 100644 --- a/main.go +++ b/main.go @@ -15,6 +15,7 @@ import ( cfgui "github.com/mailhog/MailHog-UI/config" "github.com/mailhog/MailHog-UI/web" "github.com/mailhog/http" + "github.com/mailhog/mhsendmail/cmd" ) var apiconf *cfgapi.Config @@ -30,6 +31,16 @@ func configure() { } func main() { + if len(os.Args) > 1 && os.Args[1] == "sendmail" { + args := os.Args + os.Args = []string{args[0]} + if len(args) > 2 { + os.Args = append(os.Args, args[2:]...) + } + cmd.Go() + return + } + configure() exitCh = make(chan int)