ashishdhakal/mail-sandbox

A Laravel package that intercepts outgoing emails and stores them locally for viewing via an in-app web interface.

Installs: 19

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 0

Forks: 0

Open Issues: 0

Language:Blade

pkg:composer/ashishdhakal/mail-sandbox

v1.1.2 2026-01-14 18:30 UTC

This package is auto-updated.

Last update: 2026-01-15 08:38:57 UTC


README

Mail Sandbox Logo

A Laravel package that intercepts outgoing emails and stores them locally for viewing via an in-app web interface. This is extremely useful in development environments – instead of sending real emails, you can capture them and inspect their content in a browser.

Prerequisites

  • PHP v8.1+
  • Laravel 10+

Features

  • Intercepts all outgoing emails.
  • Stores emails in a local database.
  • Web interface to list and view captured emails.
  • Configurable route prefix and middleware.
  • Easy to enable/disable via environment variables.

Installation

  1. Install the package via Composer:
composer require ashishdhakal/mail-sandbox
  1. Publish the configuration and migrations (optional):
php artisan vendor:publish --tag=mail-sandbox-config
php artisan vendor:publish --tag=mail-sandbox-migrations
  1. Run the migrations:
php artisan migrate

Configuration

You can configure the package in config/mail-sandbox.php:

return [
    'capture_enabled' => env('MAIL_SANDBOX_CAPTURE', config('app.env') !== 'production'),
    'ui_enabled' => env('MAIL_SANDBOX_UI', config('app.env') !== 'production'),
    'path' => 'mail-sandbox',
    'middleware' => ['web'],
];

Configure Mailer

Add the custom driver to your config/mail.php:

'mailers' => [
    'sandbox' => [
        'transport' => 'sandbox',
    ],
],

Update .env

Update your .env to activate it:

MAIL_MAILER=sandbox

Usage

Once installed and enabled, any email sent by your application will be intercepted and stored.

Accessing the Interface

You can view the intercepted emails at:

/mail-sandbox

For example: http://your-app.test/mail-sandbox or http://localhost:8000/mail-sandbox

Testing

To run the package's test suite, ensure you have installed the dev dependencies and run:

composer test

The tests are powered by Pest.

Credits