承接 proshore/laravel-mailcatch 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

proshore/laravel-mailcatch

Composer 安装命令:

composer require proshore/laravel-mailcatch

包简介

Package to handle mailbox in laravel

README 文档

README

PHPUnit Test PHPStan Analyze

A Laravel package that intercepts and stores all outgoing emails in your database during development and staging. View and manage caught emails through a built-in web interface.

Features

  • 📨 Automatically catches all outgoing emails in specified environments
  • 🎨 Beautiful web interface to view caught emails
  • 🔍 View HTML and text email bodies
  • 📧 See all email metadata (subject, from, to, cc, bcc, headers)
  • 🗑️ Delete individual emails or clear all at once
  • ⚡ Real-time polling for new emails
  • 🔒 Environment-based control
  • 🎯 Configurable route prefix and middleware

Requirements

  • PHP >= 8.4
  • Laravel >= 11.x

Installation

1. Install via Composer

composer require proshore/laravel-mailcatch

2. Publish Configuration (Optional)

php artisan vendor:publish --tag=mailcatch-config

3. Publish and Run Migrations

php artisan vendor:publish --tag=mailcatch-migrations
php artisan migrate

Configuration

The package publishes a config/mailcatch.php file with the following options:

return [
    // Enable or disable the package
    'enabled' => env('CATCH_MAIL_ENABLED', true),

    // Environments where emails should be caught
    'allowed_environments' => ['local', 'staging'],

    // Route prefix for the mailbox UI
    'route_prefix' => '__mailbox',

    // Middleware applied to mailbox routes
    'middleware' => ['web'],

    // Maximum length for email body (to prevent database bloat)
    'max_body_length' => 500000,

    // Enable real-time polling for new emails
    'enable_polling' => env('CATCH_MAIL_ENABLE_POLLING', true),
    
    // Polling interval in milliseconds
    'polling_interval' => env('CATCH_MAIL_POLLING_INTERVAL', 10000),
];

Environment Variables

You can control the package behavior via .env:

CATCH_MAIL_ENABLED=true
CATCH_MAIL_ENABLE_POLLING=true
CATCH_MAIL_POLLING_INTERVAL=10000

Usage

Viewing Caught Emails

Once installed, visit the mailbox interface in your browser:

http://your-app.test/__mailbox

The interface will show all caught emails with:

  • Email subject
  • From/To addresses
  • Date/time sent
  • Read/unread status

Click on any email to view:

  • Full email details
  • HTML preview
  • Text version
  • All headers
  • CC and BCC recipients

Sending Test Emails

The package automatically catches all emails sent in allowed environments:

use Illuminate\Support\Facades\Mail;
use App\Mail\WelcomeEmail;

Mail::to('user@example.com')->send(new WelcomeEmail());

The package listens to Laravel's MessageSent event to catch emails. The actual email will still be sent according to your mail configuration, but a copy will be stored in the database for viewing in the mailbox interface.

API Endpoints

The package provides API endpoints for programmatic access:

  • GET /__mailbox/api/emails - List all emails
  • GET /__mailbox/api/emails/{id} - Get specific email
  • POST /__mailbox/api/emails/{id}/read - Mark email as read
  • DELETE /__mailbox/api/emails/{id} - Delete specific email
  • DELETE /__mailbox/api/emails - Delete all emails

Accessing the Model

You can also interact with caught emails programmatically:

use Proshore\MailCatch\Models\CatchedMail;

// Get all emails
$emails = CatchedMail::all();

// Get unread emails
$unread = CatchedMail::whereNull('read_at')->get();

// Find specific email
$email = CatchedMail::find(1);

// Access email properties
echo $email->subject;
echo $email->html_body;
print_r($email->to);

Customization

Custom Route Prefix

Change the route prefix in the config file:

'route_prefix' => 'dev/emails',

Now access the mailbox at http://your-app.test/dev/emails

Add Authentication

Protect the mailbox with middleware:

'middleware' => ['web', 'auth', 'admin'],

Disable in Production

The package only catches emails in specified environments. Make sure production is not in the list:

'allowed_environments' => ['local', 'staging'],

Testing

Run the test suite:

composer test

Run code analysis:

composer analyze

Format code:

composer format

License

The MIT License (MIT). Please see License File for more information.

Credits

Contributers ✨


proshore/laravel-mailcatch 适用场景与选型建议

proshore/laravel-mailcatch 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 209 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「mailbox」 「mailbox in laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 proshore/laravel-mailcatch 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 proshore/laravel-mailcatch 我们能提供哪些服务?
定制开发 / 二次开发

基于 proshore/laravel-mailcatch 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 209
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 18
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-08