Setup Mailhog with MAMP Pro to catch outgoing emails

Jan Henkes
Oct 12, 2017 · 2 min read

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.

Installing Mailhog

To install Mailhog on your Mac we use Homebrew Mailhog (we assume you have Homebrew installed already). You can install Homebrew Mailhog using the following command in your terminal:

brew install mailhog

Open 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:

  1. Fill in your domain name in the field “Set domain of outgoing e-mails to:”
  2. Check “Use a Smart host for routing”
  3. “Server name:” is 127.0.0.1:1025 (this is the SMTP port Mailhog uses)
  4. 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 /var/log/mail.log ).

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store