As a Laravel/PHP developer, testing emails has always been a bit of a struggle. For years, I juggled between various solutions like Mailtrap and Mailjet. While these services are great, they come with their own set of limitations, such as the need to sign up and restrictions on the number of emails you can send. This made them less than ideal for local testing.
In my quest for a more efficient and hassle-free solution, I stumbled upon Mailpit. This open-source tool seemed promising, and I decided to give it a try. To my delight, setting up Mailpit was incredibly straightforward, and it has since become an indispensable part of my development toolkit.
Mailpit is a small, fast, and low-memory email testing tool that acts as an SMTP server. It provides a modern web interface to view and test captured emails, making local email testing a breeze. Unlike other solutions, Mailpit doesn’t require any sign-ups and has no limitations on the number of emails you can test.
Here’s how you can get started with Mailpit:
Visit the Mailpit GitHub repository and download the latest release for your operating system.
Run the executable file. For example, on Linux or macOS, you might use
./mailpit
.env
file, set the
MAIL_HOST
to
localhost
and
MAIL_PORT
to the port Mailpit is running on
(default is 1025):
NOTE: Mailpit is only useful for testing email locally!