Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Install MailHog on Ubuntu 16.04


Install Go programming language and Configure home directory for Go language

Digital Ocean Doc

cd ~
curl -O
tar xvf go1.6.linux-amd64.tar.gz
sudo chown -R root:root ./go
sudo mv go /usr/local
export GOPATH=$HOME/work
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
mkdir ./work

#Install MailHog Main GitHub repo
Download link for MailHog

cd ~/
sudo cp MailHog_linux_amd64 /usr/bin/mailhog

#Install mhsendmail, sendmail replacement for MailHog GitHub repo

sudo go get

This will install mhsendmail to ~/go/bin/mhsendmail, to insatll globally

sudo ln  ~/work/bin/mhsendmail /usr/bin/mhsendmail
sudo ln  ~/work/bin/mhsendmail /usr/bin/sendmail
sudo ln  ~/work/bin/mhsendmail /usr/bin/mail

#Configure PHP Add following line to php.ini

sendmail_path = /usr/bin/mhsendmail
Copy link

chisNaN commented Dec 30, 2016

thanks but perhaps several things

export with $ won't work
cd is equal to cd ~/
missing this sudo chmod +x /usr/bin/mailhog

and how to start the process

Copy link

juampynr commented Jan 19, 2018

Thanks for sharing this!

I read at that /usr/bin is reserved for distribution packages, so it's better to use /usr/local/bin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment