Skip to content

Instantly share code, notes, and snippets.

@reanim8ed
Last active August 23, 2024 22:45
Show Gist options
  • Save reanim8ed/601e8a229fdad9a6c0c78f2415217389 to your computer and use it in GitHub Desktop.
Save reanim8ed/601e8a229fdad9a6c0c78f2415217389 to your computer and use it in GitHub Desktop.
[Mailhog in Laragon] #email #laragon #laragon
  1. Download MailHog: https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_windows_amd64.exe
  2. Rename it to MailHog.exe
  3. Move it to `C:\laragon\usr\bin\MailHog.exe
  4. Open Laragon's Procfile (Menu > Laragon > Procfile) and add these lines:
  MailHog: MailHog.exe autorun
  MailHog Admin: http://localhost:8025 autorun
  1. Open F:\laragon\bin\php\php-7.1.14-Win32-VC14-x64\php.ini
  SMTP = localhost
  smtp_port = 1025
  sendmail_path="F:\laragon\usr\bin\MailHog.exe sendmail"
  1. Laragon settings, turn OFF Mail Catcher
  2. Restart Laragon
  3. Run "F:\laragon\usr\bin\MailHog.exe" and keep this open for the emails to be captured.
  4. Launch http://localhost:8025/ which will only work when 8 is running.
@Pen-y-Fan
Copy link

From the command line you can check if MailHog is till running:

tasklist | findstr /i /c:"MailHog.exe"

The output will be similar to:

MailHog.exe                   9360 Console                    1     11,188 K

To kill the process:

taskkill /im mailhog.exe /f

Which will output similar to:

SUCCESS: The process "MailHog.exe" with PID 9360 has been terminated.

This is dependent on the process being started as an administrator, you may need elevated privileges to stop it.

@ZubyApps
Copy link

This was very helpful but I'm getting this error 0
Message: Connection could not be established with host "mailhog:1025": stream_socket_client(): php_network_getaddresses: getaddrinfo for mailhog failed: No such host is known. Mailhog is the process working with that port 1025 so I don't know why the error persists.
Any help?

@Pen-y-Fan
Copy link

See my blog on How to set up Laragon on a new Windows computer (part 5) - MailHog which includes adding mailhog to the hosts file.

Alternatively, see how to install mailpit on Windows and integrate with Laragon

@ZubyApps
Copy link

@Pen-y-Fan Okay, I'll check both out. Thanks alot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment