redberry / mailbox-for-laravel
This is my package mailbox-for-laravel
Fund package maintenance!
Redberry
Installs: 1 356
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 0
Forks: 1
Open Issues: 0
Requires
- php: ^8.3
- illuminate/contracts: ^10.0||^11.0||^12.0
- inertiajs/inertia-laravel: *
- livewire/livewire: ^3.6
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9||^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^2.0||^3.0
- pestphp/pest-plugin-arch: ^2.5||^3.0
- pestphp/pest-plugin-laravel: ^2.0||^3.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1||^2.0
- phpstan/phpstan-phpunit: ^1.3||^2.0
- spatie/laravel-ray: ^1.35
README
A Laravel package that captures outgoing mail and stores it for in-app viewing. It adds an inbox
mail transport, a web dashboard for browsing messages and attachments, and convenient development defaults.
Features
- Registers configuration, routes, views, and an install command for publishing assets and config.
- Adds an
inbox
mailer transport that persists every sent email for later inspection. - Web dashboard at
/mailbox
(configurable) with authorization middleware. - Store messages on disk by default with automatic pruning.
- Works out of the box in non-production environments.
Installation
- Install the package via Composer:
composer require redberry/mailbox-for-laravel --dev
- Publish public assets and configuration:
php artisan mailbox:install # or php artisan vendor:publish --tag=mailbox-install
- Register the
inbox
mailer driver inconfig/mail.php
:'mailers' => [ // ... 'inbox' => ['transport' => 'inbox'], ],
- Use the
inbox
mailer by setting it in your.env
:MAIL_MAILER=inbox
- Go to http://localhost/mailbox
Configuration
The published config/inbox.php
file exposes several options:
INBOX_ENABLED
— enable the inbox even in production (defaults to non-production only).INBOX_GATE
— ability checked by themailbox.authorize
middleware (defaults toviewMailbox
).INBOX_DASHBOARD_ROUTE
— URI where the dashboard is mounted (/mailbox
by default).INBOX_REDIRECT
— URI where the user is redirected when they are unauthorized (defaults to Laravel's Forbidden Page).INBOX_STORE_DRIVER
&INBOX_FILE_PATH
— storage driver and path for captured messages.INBOX_RETENTION
— number of seconds before stored messages are purged.
Usage
Visit the dashboard route to browse stored messages. Attachments and inline assets are served through dedicated routes. Access is protected by the mailbox.authorize
middleware which uses Laravel's Gate system; define the viewMailbox
ability or set INBOX_PUBLIC=true
to expose it without authentication.
Testing
Run the test suite with:
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Contributions are welcome! Please submit pull requests or open issues on GitHub.
Security
If you discover any security related issues, please email security@redberry.ge instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.