Whilst you are developing your online store, it is a good idea to test the email notifications to ensure they work properly but also to ensure they look as you want them to. It isn’t always the best idea to send emails to a remote email server as it is better to catch emails locally and check it within a web interface.
In this article, I am going to show you a great SMTP testing tool called Mailhog.
Install the Mailhog
Step 1. Run following shell script to download Mailhog:
PATH_DOWNLOAD="https://github.com/mailhog/MailHog/releases/download/v0.1.8/MailHog_linux_386" PATH_MAILHOG="/usr/local/bin/mailhog" wget -qO $PATH_MAILHOG $PATH_DOWNLOAD # Make it executable chmod +x $PATH_MAILHOG
Step 2. Run following shell script to make it start automatically on system boot:
sudo tee /etc/init/mailhog.conf <<EOL description "Mailhog" start on runlevel  stop on runlevel [!2345] respawn pre-start script mailhog 1>/dev/null 2>&1 end script EOL
Update email options within Tomatocart admin panel
Step 1. Open admin panel > start menu > Configuration > Configuration > E-mail Options.
Step 2. Update options as following image shown:
- Set E-Mail Transport Method to SMTP.
- Set SMTP Server to localhost.
- Set SMTP Server Port to 1025.
- Set Enable SSL Connection to False.
- Set Send E-mails to True.
The other email settings are optional.
View messages in the web UI
Now, all of the emails sent from TomatoCart system will be caught by Mailhog. It is possible to view the messages in the web UI at the port 8025 of your web server. You could use the IP address or store domain at the specific port to access it. For example:
Mailhog is really an excellent email testing tool during development. Enjoy it.