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


  • administrators
    | 81449 points

    Here's how:

    1. Download MailHog:
      https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_windows_amd64.exe
    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
    | 81449 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

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


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

    0_1521830434741_development-mail.zip


Log in to reply
 

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