Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Mailbook Laravel Package

xammie/mailbook

Laravel dev tool to preview and inspect Mailables and Notifications without triggering them in your app. Register emails in a generated routes/mailbook.php file (with DI or closures) and browse previews at /mailbook.

View on GitHub
Deep Wiki
Context7

Laravel Mail Explorer

Frequently asked questions about Mailbook
How do I install Mailbook in a Laravel project?
Run `composer require --dev xammie/mailbook` to install the package, then execute `php artisan mailbook:install` to generate the `routes/mailbook.php` file. This file is where you register your mailables or notifications for previewing.
Can I preview Laravel notifications (not just mailables) with Mailbook?
Yes, Mailbook supports both Laravel mailables and notifications. Simply register them in `routes/mailbook.php` using `Mailbook::add(YourNotification::class)` or a closure to customize parameters.
Does Mailbook work with Laravel 9 or older versions?
Mailbook officially supports Laravel 10–13. While Laravel 9 may work with minor adjustments, the package is actively developed for newer Laravel versions, and some features (like dependency injection) may require manual tweaks.
How do I register a mailer with dynamic data (e.g., factory models) in Mailbook?
Use a closure in `routes/mailbook.php` to generate dynamic data. For example, `Mailbook::add(function () { return new VerificationMail(User::factory()->make()); })` injects a factory model into your mailer before previewing.
Will Mailbook interfere with my production email sends?
No, Mailbook is designed for development only. It registers a `/mailbook` route that should be excluded from production or protected with middleware (e.g., `auth:sanctum`). It never triggers real email sends.
Can I customize the preview UI or styling of Mailbook?
Yes, Mailbook publishes customizable views and config files. Run `php artisan vendor:publish --tag=mailbook-views` to override the default Tailwind CSS styling or modify the preview layout in `resources/views/vendor/mailbook/`.
How does Mailbook handle queued mailables (ShouldQueue) for testing?
Mailbook bypasses queues by default. For queued mailables, ensure your `ShouldQueue` logic is compatible with Mailbook’s preview mode. If issues arise, check the [GitHub issue tracker](https://github.com/Xammie/mailbook/issues) for fixes like v1.8.4’s queue handling improvements.
Does Mailbook support localization (e.g., multi-language emails)?
Yes, Mailbook respects Laravel’s localization system. Register variants for different locales in `routes/mailbook.php` using closures or pass locale-specific parameters to your mailables.
What if I get a route conflict with `/mailbook` in my Laravel app?
Mailbook installs a `/mailbook` route by default. If this conflicts with your existing routes, rename it in `routes/mailbook.php` or exclude it from production using middleware like `Route::middleware(['web', 'auth:sanctum'])->group(...);`.
Are there alternatives to Mailbook for previewing Laravel emails?
Alternatives include manually testing emails in a staging environment or using packages like `spatie/laravel-mail-preview` (for simpler setups). However, Mailbook stands out with dependency injection, closures, and built-in UI for dynamic previews without extra configuration.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope