Sometimes a Vagrant box is overkill for a simple website (at Jannes & Mannes we use Trellis a lot to develop WordPress websites) and MAMP is just the best solution. Because MAMP is a useful tool to develop PHP sites locally.
Mailhog is included in Trellis and works out of the box. Just type in your dev URL ending with the Mailhog port 8025 (e.g. website.dev:8025) and you can find all the outgoing emails sent from PHP.
To achieve the same functionality in MAMP, Mailhog needs to be installed on your Mac and the built-in SMTP server “Postfix” should be configured in MAMP.
brew install mailhog
http://127.0.0.1:8025 to check if Mailhog is running. Otherwise run
brew services start mailhog to start Mailhog.
Configuring Postfix in MAMP Pro
Open MAMP Pro and go to the “Postfix” tab. Make sure the checkbox next to “Include Postfix service in GroupStart” is checked.
Use these setting for Postfix:
- Fill in your domain name in the field “Set domain of outgoing e-mails to:”
- Check “Use a Smart host for routing”
- “Server name:” is
127.0.0.1:1025(this is the SMTP port Mailhog uses)
- Set “Authentication” to “none”
That’s it! Restart MAMP, trigger an email in PHP and go to
http://127.0.0.1:8025 in your browser to see if Mailhog receives your email. You can use the Postfix log file to debug Postfix (by default located in