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.
- Registers configuration, routes, views, and an install command for publishing assets and config.
- Adds an
inboxmailer 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.
- 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
inboxmailer driver inconfig/mail.php:'mailers' => [ // ... 'inbox' => ['transport' => 'inbox'], ],
- Use the
inboxmailer by setting it in your.env:MAIL_MAILER=inbox
- Go to http://localhost/mailbox
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.authorizemiddleware (defaults toviewMailbox).INBOX_DASHBOARD_ROUTE— URI where the dashboard is mounted (/mailboxby 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.
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.
Run the test suite with:
composer testPlease see CHANGELOG for more information on what has changed recently.
Contributions are welcome! Please submit pull requests or open issues on GitHub.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.