recently I was in a hurry and I ended up usingthe traditional MAMP tool for macOS for a personal project.
This project involved sending emails, and I wanted to test what I was sending locally.
I knew MailHog so I decided to set it up in local. It was an easy thing, but not as straightforward as I would have liked.
Here you have the steps I’d have loved to find to configure MailHog and MAMP on macOS:
- Install MailHog with
brew install mailhog.
- Start the mailhog process by running
mailhogin a terminal.
- Forget about MAMP.
- Edit your postfix configuration file
/etc/postfix/main.cf(you can do it with
sudo vim /etc/postfix/main.cf).
- Add at the bottom the following piece of code:
# For MailHog myhostname = localhost relayhost = [localhost]:1025
- Save and exit (if you are using vim
- Restart MAMP (Not sure if this is really necessary).
- Go and use your
mail()function normally in PHP.
- You should see your emails appearing in the mailhog interface at
Was it helpful? Click on the like button below to let me know!