Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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.

@conleec

This comment has been minimized.

Copy link

@conleec conleec commented May 1, 2018

Why did I have to literally spend ALL DAY trying different tutorials that didn't work, before finding this perfectly clear and accurate guide? Thank you!

@jamesfawcett

This comment has been minimized.

Copy link

@jamesfawcett jamesfawcett commented Jan 21, 2019

This still works perfect in 2019 on PHP 7.2

@iorbita

This comment has been minimized.

Copy link

@iorbita iorbita commented Feb 11, 2019

...works perfectly on Mac OS El Capitan with PHP 7.2.1 and Mamp Pro 4.5. Thank you very much! ;)

@redpop

This comment has been minimized.

Copy link

@redpop redpop commented Feb 16, 2019

works on macOS Mojave 10.14.3 with PHP 7.2.10 and MAMP PRO 5.2.2 and TYPO3 9.5.4
for TYPO3 - LocalConfiguration.php:

'MAIL' => [
        'transport' => 'smtp',
        ...
        'transport_smtp_server' => 'localhost:1025',
        ...
],

THX

@jack-fdrv

This comment has been minimized.

Copy link

@jack-fdrv jack-fdrv commented Nov 3, 2019

This is only solution which works for me

@jarcos

This comment has been minimized.

Copy link

@jarcos jarcos commented Dec 15, 2019

Works great with MAMP 5 and PHP 7.3.

Thanks.

@vrdriver

This comment has been minimized.

Copy link

@vrdriver vrdriver commented Jan 29, 2020

Wow. So good. Thanks heaps. It means I can check the emails that were 'sent' - regardless if they arrived or not. So good for dev work.

@metaxos

This comment has been minimized.

Copy link

@metaxos metaxos commented Feb 7, 2020

Cool work, easy setup with your infos. Thank you.

@mgrn0

This comment has been minimized.

Copy link

@mgrn0 mgrn0 commented Feb 10, 2020

works on macOS Mojave 10.14.3 with PHP 7.2.10 and MAMP PRO 5.2.2 and TYPO3 9.5.4
for TYPO3 - LocalConfiguration.php:

'MAIL' => [
        'transport' => 'smtp',
        ...
        'transport_smtp_server' => 'localhost:1025',
        ...
],

THX

Thanks, this combination works for me with MAMP pro and PHP 7, with lower PHP versions I did not need this setting in the localconf file.

@stevengliebe

This comment has been minimized.

Copy link

@stevengliebe stevengliebe commented Feb 26, 2020

Thanks for sharing this.

@mikeebee

This comment has been minimized.

Copy link

@mikeebee mikeebee commented Mar 6, 2020

Thanks so much for this

@jamessy

This comment has been minimized.

Copy link

@jamessy jamessy commented Mar 31, 2020

Thanks for showing the setup.

@mjot

This comment has been minimized.

Copy link

@mjot mjot commented Apr 22, 2020

Works fine with MAC OS Catalina 10.15.4 (19E287) and PHP 7.4.2 and MAMP Pro 5.7

@romellem

This comment has been minimized.

Copy link

@romellem romellem commented Jul 21, 2020

One small thing that might not be obvious, whenever you make a change to your php.ini file, you need to restart your webserver.

If you are using MAMP, then after adding the sendmail_path path line, just stop and start the MAMP Servers to get this working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.