Sometimes you run into an issue with a shop and wish you could see all the outgoing mail from a webshop to debug. Send out as many test emails as you’d like none will reach your customers. MailHog is an email testing tool for developers to catch all these emails in a single mailbox.
Careful, any mail send out while MailHog is activated will be consumed by MailHog. The mails caught by MailHog will not reach your customers. After MailHog is deactivated only the mails send after deactivation will reach the customers.
How to activate MailHog?
To install MailHog on a Hypernode MailHog first needs to be enabled. This can be done using the following command through the CLI.
hypernode-systemctl settings mailhog_enabled --value True
This will install and activate MailHog. (Might take a couple minutes)
How to use MailHog?
After the setting is changed and the node is updated all mail send from the Hypernode will be caught in the MailHog mailbox. Mail will not reach customers anymore.
To access MailHog we need to link the 8025
port on the Hypernode to our own 8025
port. This can be done using a SSH connection. Enter the following command on the CLI on your local computer.
ssh app@appname.hypernode.io -L 8025:localhost:8025
This will forward localhost:8025
(where MailHog is running) to our local 8025
port. Now going to localhost:8025
in a browser will show the MailHog mailbox with all the mails it catches from the Hypernode.
How to deactivate MailHog?
If using a development node MailHog can keep running, but if something was tested on the production node it needs to be turned off after use. Luckily this is as easy as turning MailHog on. Using the following command.
hypernode-systemctl settings mailhog_enabled --value False
Wait for the Hypernode to uninstall MailHog and restore all the normal mail settings. (might take a couple minutes)