statamic/mailables-viewer

Preview Laravel mailables from the Statamic Control Panel.
1,042 11
Install
composer require statamic/mailables-viewer
Latest Version:v1.1.0
PHP:^8.2
Laravel:12 · 13
License:MIT
Last Updated:Oct 15, 2026
Links: GitHub  ·  Packagist
Maintainer: jackmcdade

Mailables Viewer

Preview Laravel mailables from the Statamic Control Panel.

Mailables Viewer

Features

  • Discovers concrete Illuminate\Mail\Mailable classes in app/Mail
  • Renders a live HTML preview
  • Injects sample constructor data (scalars, Eloquent models, Statamic users/entries/forms)
  • Lets you edit strings, numbers, bools, and datetimes and see the preview update
  • Shows subject, from, attachments, template, queue status, and where the mailable is referenced
  • Sends a test email with sendNow()
  • Opens a chosen mailable directly via ?mailable=

Installation

You can install the Mailables Viewer addon via Composer:

composer require statamic/mailables-viewer

Then visit Utilities → Mailables in the Control Panel. Super users see it automatically. Everyone else needs the access mailables utility permission.

Usage

Any concrete mailable in app/Mail is discovered automatically.

Register mailables that live elsewhere:

use Statamic\MailablesViewer\Mailables;

Mailables::register(\App\Mail\Billing\InvoiceReady::class);

You can pass a class or an array of classes. The Mailables facade is also available as a Laravel alias.

Linking to a mailable

Add ?mailable= to the utility's URL to open the viewer with that mailable already selected:

cp_route('utilities.mailables', ['mailable' => \App\Mail\OrderShipped::class]);

Useful for a "preview this email" button elsewhere in the Control Panel. A class the viewer does not have falls back to the first mailable in the list.

Constructor data

The viewer instantiates each mailable with sample values so you can preview it without writing a factory.

Type What happens
string, int, float, bool, datetimes Fake sample values you can edit in Details
Statamic User, Entry, Form, Submission First available record
Eloquent models Factory make(), then query()->first(), then ::make()
Anything else Resolved from the container

Objects and arrays stay read-only. Edit a scalar and the preview plus envelope (subject, from, attachments) refresh live.

Sample strings are guessed from the parameter name (email → preview@example.com, name → Jane Doe, url → https://example.com).

Sending tests

Pick a mailable, optionally tweak the editable values, enter an address, and send. Tests use sendNow() so queued mailables still go out immediately.

Requirements

  • PHP 8.2+
  • Statamic 6

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

644,549,754 9,698
laravel/framework

The Laravel Framework.

598,760,099 34,966
laravel/tinker

Powerful REPL for the Laravel framework.

507,193,856 7,441
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

423,477,751 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

403,217,078 4,664

Version History

Version Released PHP License
v1.1.0 ^8.2 MIT
v1.0.1 ^8.2 MIT
v1.0.0 ^8.2 MIT