Local Mail Server for Testing Emails Instead of Using MailTrap.io – A Guide for Laragon Users

  • Shows how to replace external tools like Mailtrap with Mailpit for fully local email testing inside Laragon.

  • Walks through installing Mailpit, wiring it into Laragon, and configuring Laravel’s .env for SMTP.

  • Covers how to route both Laravel mailers and PHP’s native mail() function into Mailpit for safe testing.

  • Includes testing steps, autostart setup, and troubleshooting so emails never leave your machine.

Last Update: 29 Oct 2024
Local Mail Server for Testing Emails Instead of Using MailTrap.io – A Guide for Laragon Users image

Why Use Laragon?

Setting Up Mailpit with Laragon

Setting Up Project Email Settings

Testing the Setup

Configuring PHP mail() Function

Testing PHP’s mail() Function

Stopping Mailpit

Troubleshooting

Final Thoughts

Frequently Asked Questions

Yes, Mailpit can work with any application that supports SMTP for sending emails. Simply configure the application's email settings to use mailpit as the hostname and 1025 as the port. For applications that rely on PHP’s mail() function, you can adjust the php.ini file settings in Laragon to direct email through Mailpit as outlined in the guide.

Author

Chief Technology Officer ( CTO )

Get the best of our content straight to your inbox!

By submitting, you agree to our privacy policy.

Let's
Talk