New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

ashishdhakal/mail-sandbox

A Laravel package that intercepts outgoing emails and stores them locally for viewing via an in-app web interface.
8,663 10
Install
composer require ashishdhakal/mail-sandbox
Latest Version:v2.0.0
PHP:^8.1
Laravel:10 – 13
License:MIT
Last Updated:Apr 29, 2026
Links: GitHub  ·  Packagist
Maintainer: Ashish-Dhakal

Mail Sandbox for Laravel

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+ (PHP 8.4 required for Laravel 13 projects)
  • 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

Related Packages

redberry/mailbox-for-laravel

Capture outgoing Laravel mail in a local dashboard and assert against the fully...

45,558 126
bpedroza/laravel-mail-assertions

Make assertions on mail in laravel.

4,257 3
frontier-sh/sinkhole-laravel

Laravel mail transport for Sinkhole — a Cloudflare Worker email trap

2,805 0
a2zwebltd/laravel-dev-mode

A lightweight Laravel package that lets developers temporarily bypass Gate autho...

1,450 3
league/factory-muffin

The goal of this package is to enable the rapid creation of objects for the purp...

15,906,405 533

Version History

Version Released PHP Laravel License
v2.0.0 ^8.1 ^10.0 || ^11.0 || ^12.0 || ^13.0 MIT
v1.2.0 ^8.1 ^10.0 || ^11.0 || ^12.0 || ^13.0 MIT
v1.1.2 ^8.1 ^10.0 || ^11.0 || ^12.0 MIT
v1.1.1 ^8.1 ^10.0 || ^11.0 || ^12.0 MIT
v1.1.0 ^8.1 ^10.0 || ^11.0 || ^12.0 MIT