定制 rulr/laravel-mailpot 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

rulr/laravel-mailpot

Composer 安装命令:

composer require rulr/laravel-mailpot

包简介

A local mail inbox for Laravel

README 文档

README

A local mail inbox for Laravel. No external tools or services required. Mailpot lets you intercept, store, and inspect emails sent during development.

Think of it like Mailtrap or Mailhog, but fully embedded in your Laravel app. No Docker, no SMTP config, no fuss.

Screenshot

Features

  • Stores sent mails as .json files
  • Clean inbox UI built with Tailwind and Alpine.js
  • Read/unread tracking (client-side, no database required)
  • Resizable viewport preview (mobile, tablet, desktop)
  • Stats: message count, storage size, largest/smallest message
  • Artisan commands for cleaning inbox and viewing stats
  • Configurable storage path
  • No third-party tools or services
  • Compatible with Laravel 10, 11, and 12

Installation

composer require --dev rulr/laravel-mailpot

This package is intended for local development only.

Mail Configuration

Update your config/mail.php file to add the mailpot mailer:

'mailers' => [
    'mailpot' => [
        'transport' => 'mailpot',
    ],
    // ...
],

Set the mailer in your .env file:

MAIL_MAILER=mailpot

Publishing Configuration

To customize the storage path, publish the configuration file:

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

This creates config/mailpot.php with the following options:

return [
    'storage_path' => env('MAILPOT_STORAGE_PATH', storage_path('framework/mailpot')),
];

You can set a custom path in your .env file:

MAILPOT_STORAGE_PATH=/path/to/custom/mailpot

If not configured, messages are stored in storage/framework/mailpot.

Web UI

Visit the inbox in your browser:

http://localhost:8000/mailpot

The interface allows you to:

  • Browse and read emails with subject, from, to, date, and content
  • Switch between mobile, tablet, and desktop viewport sizes
  • Resize the viewport manually for custom widths
  • Track read/unread status (stored in browser localStorage)
  • View inbox statistics when no email is selected

The web UI is only available when APP_ENV=local.

Artisan Commands

Show Stats

php artisan mailpot:stats

Displays a summary of:

  • Total message count
  • Total inbox size
  • Largest and smallest message
  • Latest message details

Clean Inbox

php artisan mailpot:clean

Deletes all stored messages. You will be prompted to optionally delete the stats file as well.

Testing

This package uses Orchestra Testbench.

Run tests with:

composer test

Or directly:

./vendor/bin/phpunit

Code Quality

Run static analysis:

./vendor/bin/phpstan analyse

Run code style fixes:

./vendor/bin/pint

Files and Storage

Messages are saved to the configured storage path (default: storage/framework/mailpot).

  • Each email is stored as a .json file
  • stats.json contains cached statistics
  • .gitignore is auto-generated to exclude messages from Git

Recommended .gitignore

/vendor
/.phpunit.result.cache
/storage/framework/mailpot/*
!/storage/framework/mailpot/.gitignore

License

MIT. See LICENSE.md

Contributing

Feel free to submit PRs or open issues. Bug fixes, ideas, and improvements are welcome.

Credits

Created by Rulr for Laravel developers who want email to work locally.

rulr/laravel-mailpot 适用场景与选型建议

rulr/laravel-mailpot 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 2.37k 次下载、GitHub Stars 达 16, 最近一次更新时间为 2025 年 07 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-11