redberry/mailbox-for-laravel

This is my package mailbox-for-laravel

v1.0.7 2025-10-01 10:16 UTC

This package is auto-updated.

Last update: 2025-10-03 13:04:38 UTC


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

  1. Install the package via Composer:
    composer require redberry/mailbox-for-laravel --dev
  2. Publish public assets and configuration:
    php artisan mailbox:install
    # or
    php artisan vendor:publish --tag=mailbox-install
  3. Register the inbox mailer driver in config/mail.php:
    'mailers' => [
        // ...
        'inbox' => ['transport' => 'inbox'],
    ],
  4. Use the inbox mailer by setting it in your .env:
    MAIL_MAILER=inbox
  5. 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 the mailbox.authorize middleware (defaults to viewMailbox).
  • 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.