Running Mailpit for SMTP and UI on MacOS

WBOY
Release: 2024-08-29 06:34:31
Original
540 people have browsed it

Running Mailpit for SMTP and UI on MacOS

Mailpit is a tool for handling fake email deliveries, useful during application development. This tutorial will guide you through setting up and running Mailpit on MacOS with SMTP and UI configuration.

Step 1: Install Mailpit
Download and install Mailpit from the official GitHub repository. Choose the appropriate binary for MacOS.

Step 2: Running Mailpit
To start Mailpit, use the following command:

mailpit --smtp 0.0.0.0:1025 --listen 0.0.0.0:8025
Copy after login

This command starts the SMTP server on port 1025 and the web UI on port 8025.

SMTP: 0.0.0.0:1025 handles email delivery.
UI: 0.0.0.0:8025 allows you to view sent emails.
If you encounter an error stating that the address is already in use, ensure no other service is running on the same port. You can use a different port if needed by adjusting the command.

Step 3: Configuring Laravel Mail Settings
In your Laravel .env file, configure the mail settings:

env

MAIL_MAILER=smtp MAIL_HOST=127.0.0.1 MAIL_PORT=1025 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS="hello@example.com" MAIL_FROM_NAME="${APP_NAME}"
Copy after login

This configuration directs Laravel to send emails through Mailpit's SMTP server.

Step 4: Testing Email Sending
When your application sends an email, you can view it in the Mailpit UI by navigating to:

http://localhost:8025
This will display all emails sent by your application.

Troubleshooting
Connection Refused: Ensure Mailpit is running on the correct port (1025 for SMTP).
Port Conflict: If you encounter a "bind: address already in use" error, change the port in the command or stop the conflicting service.
That's it! You've successfully set up Mailpit to handle and display fake email deliveries in your development environment.

The above is the detailed content of Running Mailpit for SMTP and UI on MacOS. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!