在 MacOS 上运行 Mailpit for SMTP 和 UI

WBOY
发布: 2024-08-29 06:34:31
原创
540 人浏览过

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
登录后复制

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}"
登录后复制

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.

以上是在 MacOS 上运行 Mailpit for SMTP 和 UI的详细内容。更多信息请关注PHP中文网其他相关文章!

来源:dev.to
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!