Set Up SMTP/Email for Local Valet WordPress Development

If you have a Laravel  WordPress Valet workflow, you can use MailHog as an email SMTP catchall solution when testing email issues. You set up an SMTP host on the WordPress install and all email sent gets captured in MailHog, a minimal and straightforward solution.

Install MailHog

Install MailHog and start via Homebrew

brew install mailhog

brew services start mailhog

You can access MailHog via http://localhost:8025/ or http://127.0.0.1:8025

Mailhog Valet WordPress Local Smtp

Install SMTP Host on local WordPress

Use a plugin like WP Mail SMTP or Post SMTP Mailer/Email Log to change the SMTP settings from PHP to a custom SMTP host.

Wordpress Smtp Host Setup

 

So in the settings above using WP Mail SMTP – the mailer is swapped to ‘Other SMTP‘ and the host is set to mailhog.test and the SMTP Port is set to 1025 – the SMTP Hostname can be anything but keep the domain name the same i.e .test

That’s it now you can test any SMTP issues and see the caught emails in MailHog.