News

Statamic Mailables Viewer Previews Laravel Emails in the Control Panel

Published
Statamic Mailables Viewer Previews Laravel Emails in the Control Panel image

Mailables Viewer is a new free Statamic add-on from Jack McDade that discovers the Laravel mailables in an application and makes them available under Utilities → Mailables in the Control Panel.

If you're anything like me, you've got a bunch of /preview-email/{email} routes sitting in web.php, commented out until you need them. You know the ones. They new up a WelcomeEmail Laravel mailable with a pile of fake data, dump the HTML, and give you a webpage you can hit while you make your changes.

Or maybe you're even lazier and you just send it to yourself. Again. And again. You're afraid Herd Pro or Mailtrap are starting to judge you. Been there too.

Well, I got tired of that and built Mailables Viewer.

The add-on renders each mailable's HTML without requiring dedicated preview routes or configuration. It generates sample constructor data, lets you edit scalar values while watching the preview and envelope update, and provides desktop, tablet, and mobile views. You can also inspect the subject, sender, attachments, template, queue status, and references to the mailable within the codebase.

Mailables Viewer can copy the rendered HTML or send a test with sendNow(), including mailables that normally use a queue. Objects and arrays remain read-only, while strings, numbers, booleans, and dates can be changed in the data editor. Mailables outside the default app/Mail directory can be registered through the add-on's facade.

Super users receive access automatically, and other roles can be granted the access mailables utility permission. Read McDade's announcement for screenshots and the full walkthrough.

Eric L. Barnes photo

Eric is the creator of Laravel News and has been covering Laravel since 2012.

Sponsored

masteringlaravel logo
Laravel Code Review

Get expert guidance in a few days with a Laravel code review

Visit Laravel Code Review

The latest

View all →
Taylor disabled GitHub Issues on most Laravel open-source packages. image

Taylor disabled GitHub Issues on most Laravel open-source packages.

Read article
Exclude Vendor and Default Commands in `php artisan dev` image

Exclude Vendor and Default Commands in `php artisan dev`

Read article
The Laracon Archive image

The Laracon Archive

Read article
Group Adjacent Collection Items in Laravel with chunkBy() image

Group Adjacent Collection Items in Laravel with chunkBy()

Read article
Laravel queue:work Now Prints Why the Worker Stopped image

Laravel queue:work Now Prints Why the Worker Stopped

Read article
Sidecar Brings Statamic's Control Panel to Your Existing Markdown Sites image

Sidecar Brings Statamic's Control Panel to Your Existing Markdown Sites

Read article