How to configure your Mailhog and Postfix on Mac Os (Mojave)

Sometimes you need to check how look the emails in your development. Mailhog is quite good for that. We are going to see how to configure it and which settings we have to do in Postfix.


ruby -e "$(curl -fsSL"

If brew is already installed

brew update


brew install mailhog

then run

brew services start mailhog

now, you should be able to see Mailhog at this address:

open your php.ini file and search for sendmail_path . This part could be commented, just uncomment it and add this value :

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

make sure that your mailhog version is 1.0.0 otherwise, you just have to adapt the version in the sendmail_path

To check your Mailhog version you can run this command : brew info mailhog


edit the file


and add these lines at the end :

# For MailHog
myhostname = localhost
relayhost = [localhost]:1025

now you can test to send an email from your terminal :

echo "Test sending email from Postfix" | mail -s "Test Email"

If it’s not working check if your email is in the queue with this commad :


If you get an error like

(Host or domain name not found. Name service error for name=localhost type=AAAA: Host not found)

then change your config in the put previously by this :

# For MailHog
myhostname = localhost
relayhost = []:1025

This Post Has 4 Comments

  1. Is this correct?
    sendmail_path = /usr/local/Cellar/mailhog/1.0.0/bin/MailHog sendmail test@test

    1. yes, it works for me.
      No matter what you put as email address at the end

  2. Thanks for this. I couldn’t figure out why it wasn’t working and it was the postfix piece. I also used sendmail_path = /usr/local/bin/MailHog sendmail test@test as that has the symlinked path and it works also.

    1. You are welcome 🙂

Name (required)Email (required)Website

Leave a Reply