Stratus Guides - Install MailHog

MailHog is a popular tool for testing Email templates on any platform.
  1. In the SSH container, navigate to ~/bin directory and execute the following command:
wget -c
  1. Extract archive:
tar -xvf go1.19.5.linux-amd64.tar.gz
  1. Export PATH:
export PATH=$PATH:/srv/bin/go/bin
  1. Navigate to /srv/pwa directory and execute:
go install
  1. Adjust file in the /srv/pwa directory or create it fresh with the following details:
export PATH=$PATH:/srv/bin/go/bin
/srv/go/bin/MailHog -ui-web-path /mailhog -smtp-bind-addr

Note: If you are already running some NodeJS application, adjust the export path accordingly as an add-on to the current NVM settings.

  1. Test ./ before starting up the Node container from within the Stratus panel. This is how it should look if MailHog is started properly:
  1. Following NodeJs guidelines navigate to your Stratus panel and start the container. If everything remains in the “Running” state, the MailHog container is started successfully and fully functional.

  2. Next, we need to download and install mhsendmail tool and adjust the PHP configuration to use it when sending emails.

cd ~/bin
chmod +x mhsendmail_linux_amd64
mv mhsendmail_linux_amd64 mhsendmail
  1. Add the following alias to the ~/.bashrc file:
alias mhsendmail='/srv/bin/mhsendmail'
export PATH=$PATH:/srv/bin/go/bin
  1. Create the /srv/ file:
/srv/bin/mhsendmail --smtp-addr=nodejs:10000
  1. Navigate to Stratus panel → PHP → Option section and add the following:
  1. The last step is to add the following into the Nginx → Includes section area from within the Stratus panel:
location /mailhog {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-SSL-offloaded $ssl_offloaded;
proxy_buffer_size          128k;
proxy_buffers              4 256k;
proxy_busy_buffers_size    256k;

When you start the container and add the Nginx rule, the UI should look as follows:

Last modified January 1, 0001