[Tutorial] How to add MailHog to Laragon and make it autorun using Procfile
-
Here's how:
- Download MailHog:
https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_windows_amd64.exe - Move it to `C:\laragon\usr\bin\MailHog.exe
- Open Laragon's Procfile (Menu > Laragon > Procfile) and add these lines:
MailHog: MailHog.exe autorun MailHog Admin: http://localhost:8025 autorun
That's all. I hope you enjoyed yourself
- Download MailHog:
-
1 liner (using Menu > Laragon > Terminal):
cd %LARAGON_ROOT%\usr & curl -L https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_windows_amd64.exe > bin\MailHog.exe & echo MailHog: MailHog.exe autorun >> Procfile & echo MailHog Admin: http://localhost:8025 autorun >> Procfile
-
Thank you. I opened URL and it is working.
Just to find out how to connect it with Laragon (PHP) PHPMailer function.
Sent few messages via contact forms on different websites and Inbox still shows (0).
-
@Stagger-Lee
MailHog will act as a local smtp server, so when you create the smtp connection with PHPMailer, you need to give it the following settings:MAIL_DRIVER=smtp MAIL_HOST=127.0.0.1 MAIL_PORT=1025 MAIL_USERNAME=testuser MAIL_PASSWORD=testpwd
Ports can change depending on the config you set up MailHog with. It's also possible that it won't require any authentication... depends on the use case.
-
Thank you @blackfyre. Lost some time because of overflow of options for WordPress code. Now it is OK.
Here it is a few lines plugin for WordPress. Just install it as any plugin. Or take action hook out and use in custom functions.php. Maybe better to install as a plugin. Later can be deleted. Less risk later will remain on production site and ruin mail sending.