[Tutorial] How to add MailHog to Laragon and make it autorun using Procfile

  • administrators
    | 83971 points

    Here's how:

    1. Download MailHog:
    2. Move it to `C:\laragon\usr\bin\MailHog.exe
    3. 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 :)

  • administrators
    | 83971 points

    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

  • | 282 points

    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).

  • | 314 points

    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:


    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.

  • | 282 points

    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.


Log in to reply

Looks like your connection to Laragon was lost, please wait while we try to reconnect.