For developers working on Laravel or WordPress, few things are as frustrating as testing “Forgot Password” links or contact forms on a local server. You don’t want to send real emails to real clients during development, but you need to see exactly how those emails look and behave.
If you are using a local environment like Laragon, you have two powerful options: the built-in Mail Catcher and the more robust Mailpit. Here is how to master both.
1. The Quick Start: Laragon’s Built-in Mail Catcher
Laragon’s native Mail Catcher is perfect for quick tests. It intercepts outgoing emails and prevents them from leaving your machine.
How it Works:
When an email is “caught,” Laragon triggers a Windows system notification and saves the email as a physical file.
Setup:
Enable the Service: Open Laragon > Menu > Preferences > Services & Ports and check Mail Catcher.
The Port: By default, it listens on port 1025.
Viewing Emails: There is no web interface. Instead, navigate to C:\laragon\bin\sendmail\output. Every email sent is saved here as an .html file that you can open in your browser.
Pro Tip: This is the best “zero-config” option for simple PHP scripts using the standard mail() function.
2. The Professional Choice: Mailpit
If you need a modern web interface, searchable history, and mobile-responsive previews, Mailpit is the industry standard.
Setting up Mailpit in Laragon:
Since Mailpit isn’t built into older versions of Laragon, you can add it manually:
Download the Mailpit binary and place it in C:\laragon\bin\mailpit\.
Add it to your Procfile (Right-click Laragon > Laragon > Procfile):
Mailpit: C:\laragon\bin\mailpit\mailpit.exe
Mailpit UI: http://localhost:8025
Restart Laragon. You can now view your inbox at http://localhost:8025.
3. Configuring Laravel for Local Emails
Laravel is designed to be “pluggable,” but it often caches its configuration, which can lead to “emails not sending” errors.
The .env Setup:
Update your .env file to point to your local port:
Code snippet
MAIL_MAILER=smtp
MAIL_HOST=127.0.0.1
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
The “Gotcha” Fix:
If you change your .env and nothing happens, your config is likely cached. Always run this command after a change:
Bash
php artisan config:clear
Additionally, if your “Forgot Password” emails aren’t appearing, check if your QUEUE_CONNECTION is set to sync. If it’s set to database, the email won’t “send” until you run php artisan queue:work.
4. Configuring WordPress for Local Emails
WordPress handles mail differently. By default, it tries to use the server’s php.ini settings.
Option A: The php.ini Method (Global)
If you want every WordPress site on your Laragon server to use Mailpit, edit your php.ini:
Find sendmail_path.
Set it to: sendmail_path = “\”C:/laragon/bin/mailpit/mailpit.exe\” sendmail”
Restart Laragon.
Option B: The Plugin Method (Recommended)
For more control, use a plugin like WP Mail SMTP.
Install the plugin.
Select Other SMTP as the mailer.
Set the SMTP Host to 127.0.0.1 and the Port to 1025.
Set Encryption to None and Authentication to Off.
Which one should you use?
Use Mail Catcher if: You want a lightweight, “set it and forget it” tool and don’t mind looking at files in a folder.
Use Mailpit if: You are building complex HTML emails, testing across multiple local sites, or need a beautiful UI to show stakeholders during a local demo.
By mastering these two tools, you turn a potentially buggy part of development into a streamlined, fail-safe workflow. Happy coding!