Skip to content

Instantly share code, notes, and snippets.

@shakhmehedi
Last active November 8, 2018 10:19
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shakhmehedi/bbeb643079171be322eb6e9d08c7c020 to your computer and use it in GitHub Desktop.
Save shakhmehedi/bbeb643079171be322eb6e9d08c7c020 to your computer and use it in GitHub Desktop.
Install MailHog on Ubuntu 16.04

#Prerequisit

Install Go programming language and Configure home directory for Go language

Digital Ocean Doc

cd ~
curl -O https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz
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 ~/
wget https://github.com/mailhog/MailHog/releases/download/v0.2.1/MailHog_linux_amd64
sudo cp MailHog_linux_amd64 /usr/bin/mailhog

#Install mhsendmail, sendmail replacement for MailHog GitHub repo

sudo go get github.com/mailhog/mhsendmail

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
@juampynr
Copy link

Thanks for sharing this!

I read at https://unix.stackexchange.com/a/8658/30962 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