Magento 2 Mailpit Setup: A Quick Guide for Laragon

When developing an eCommerce store locally, testing your email flow is an absolute must. Whether it is customer registration, order confirmations, or password resets, you need to ensure these system emails are working correctly.
Fortunately, if you use Laragon, you do not need to configure a real SMTP server like Gmail (which can lead to spam issues). Laragon comes with an excellent built-in mail catcher called Mailpit (the modern replacement for Mailhog).
In this tutorial, we will walk you through a complete Magento 2 Mailpit setup so you can capture and preview all outgoing local emails safely.

(Note: If you have not configured your local environment yet, check out our comprehensive guide on how to install Magento 2.4.7 on Laragon first!)

Steps To Setup Mailpit For Magento 2 On Laragon

Step 1: Start and Access Mailpit in Laragon

To begin your Magento 2 Mailpit setup, you first need to ensure the service is running. By default, Mailpit might not start automatically when you launch Laragon.

1. Open your Laragon application.

2. Click the Mailpit toggle button.

3. To view your local inbox, click Menu > Mailpit > Web UI. Alternatively, you can open your browser and navigate directly to http://localhost:8025.

Keep this browser tab open. This is where all your intercepted Magento emails will appear.

Step 2: Configure Magento 2 SMTP Settings

Starting from Magento 2.4.4, the core system includes native SMTP configuration. We just need to point Magento’s outgoing mail to Mailpit’s local port.

1. Log in to your Magento 2 Admin Panel.

2. Navigate to Stores > Settings > Configuration.

3. On the left panel, scroll down to the Advanced tab and click on System.

4. Expand the Mail Sending Settings section.

5. Configure the settings exactly as follows:

  • Disable Email Communications: No (Crucial: Set this to No to allow emails to be sent).
  • Transport: SMTP
  • Host: 127.0.0.1 (or localhost)
  • Port: 1025 (This is the default SMTP port for Mailpit).
  • Auth: None (No authentication is needed for local testing).
  • SSL/TLS: None (Encryption is not required locally).

6. Click the Save Config button at the top right corner.

To ensure these new settings take effect, open your Laragon Terminal and flush the Magento cache:

php bin/magento cache:flush

Step 3: Test the Email Flow via Storefront

Now that your Magento 2 Mailpit setup is complete, let’s test the system by simulating a real customer action directly from your storefront.

1. Open your Magento storefront.

2. Click on Create an Account at the top header.

3. Fill in the required details (First Name, Last Name, and a test email address like [email protected]).

4. Click the Create an Account button.

5. Once the account creation is successful, switch back to your Mailpit Web UI tab (http://localhost:8025).

You should immediately see a “Welcome to Main Website Store” email sitting in your local inbox. You can click on it to preview the HTML template, check the headers, and verify that your Magento email system is functioning perfectly!

Conclusion

Testing emails locally does not have to be complicated. By taking advantage of Laragon’s built-in Mailpit utility and Magento’s native SMTP settings, you can intercept and review all outgoing messages in a matter of minutes.

If you found this guide helpful, be sure to explore our other Magento 2 development tutorials!

5 1 vote
Article Rating
Aaron LX

Aaron LX

Aaron is a passionate writer, crazy about shopping, eCommerce and trends. Besides his outstanding research skills and a positive mind, Aaron eagerly shares his experience with the readers.

Leave a Reply or put your Question here

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x