Skip to content

Instantly share code, notes, and snippets.

@jaredatch
Created January 30, 2018 21:57
Install MailHog with MAMP Pro

Install MailHog with MAMP Pro, using HomeBrew.

MailHog

First let's make sure HB is updated. Open up terminal for the following steps.

$ brew update

Now let's install MailHog.

$ brew install mailhog

Set MailHog to start when OSX boots.

$ brew services start mailhog

Now you can access MailHog at it's default location, http://127.0.0.1:8025/

Lastly, we need to configure MAMP's PHP to use MailHog.

Edit the php.ini for the version of PHP you are using with MAMP.In MAMP: File > Edit Template > PHP (php.ini) > 7.1.8 (latest PHP MAMP includes at the time of writing this).

Search for sendmail_path in your php.ini, by default is is commented out, uncomment it. Change value to below:

sendmail_path = /usr/local/Cellar/mailhog/1.0.0/bin/MailHog sendmail test@test

Current MailHog version is 1.0.0. To find the current version run $ brew info mailhog.

Notes:

My homebrew install contained both 0.2.1 and 1.0.0. Using either of these in the sendmail config seemed to work in my use case, but I kept 1.0.0 in the config.

When MAMP updates are installed, they generally include updated versions of PHP, and configuration changes to the php.ini are usually lost. So make a note that when you update MAMP (or if you toggle between PHP versions) you will need to reconfigure the sendmail_path in your php.ini.

@stevengliebe
Copy link

Mailhog is included with MAMP 6 now.

@urukai
Copy link

urukai commented Dec 3, 2020

In order to activate Mailhog in the MAMP Application, I had to deactivate Postfix first.

@atep77
Copy link

atep77 commented Feb 22, 2021

Hi, thanks and for me, works with a little change in path for sendmail_path = (after instalation with brew ):
/usr/local/Cellar/mailhog/1.0.0/bin/MailHog -> /usr/local/bin/mailhog
Thanks.
Petr

@jaredatch
Copy link
Author

Worth noting that MAMP v6.x includes Mail Hog natively now, so no more manual hacks needed :)

@SebastienGicquel
Copy link

Worth noting that MAMP v6.x includes Mail Hog natively now, so no more manual hacks needed :)

It works very well. For the host, I set 127.0.0.1 in the settings of my Drupal Synfony Mailer module so that the emails sent are properly captured. I imagine that this host works for other types of CMS or applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment