Erik Larsson – April 10, 2019
One big annoying part of developing eg. e-mail scripts, forms and order confirmations, is debugging the emails itself. You often just put in our own email and fill your own inbox with spam and numerous emails.
What happens if your email goes out live? You accentual put in the wrong email address or you just run the wrong script and a mass mailing script starts. That’s not a fun way to start the day.
With Mailhog you can safeguard your local development when testing outgoing email.
Mailhog catches every email going out from your application and relay it to the mailhog inbox.
Open the terminal and run this command:
docker run --restart unless-stopped --name mailhog -p 1025:1025 -p 8025:8025 -d mailhog/mailhog
When Mailhog is up and running you can access the local inbox via the web interface: http://localhost:8025/
Then just enable your application to send email via SMTP and set the host to.
Host/Server: host.docker.internal Port: 1025
If you are using WordPress you can download a plugin to enable these settings. Here is one of many plugins you can use, Easy WP Smtp
Read more about Mailhog