定制 rulr/laravel-mailpot 二次开发

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

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

rulr/laravel-mailpot

最新稳定版本:v1.1.0

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.

统计信息

  • 总下载量: 1.04k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

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