ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
If brew is already installed
brew update
brew install mailhog
then run
brew services start mailhog
now, you should be able to see mail at this address: http://127.0.0.1:8025/
open your php.ini
file and search for sendmail_path
. This part could be commented, just uncomment it and add this value :
sendmail_path = "{/path/to/your/mailhog/installation}/bin/MailHog sendmail test@test"
to get your mailhog installation path run the command: brew info mailhog
and check for "Installed" keyword in the output
edit the file
/etc/postfix/main.cf
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" [email protected]
If it's not working check if your email is in the queue with this commad :
mailq
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 main.cf put previously by this :
# For MailHog
myhostname = localhost
relayhost = [127.0.0.1]:1025