This package gives an ability to log all outgoing emails to a database and view them all from a browser like they will be shown in a modern mail clients (gmail, etc.).
| Laravel | Mail Viewer |
|---|---|
| 5.5.x - 8.* | 1.3.x |
| 9.x - 10.x | 2.x.x |
Version 2 has been almost totally rewritten and brings totally new fresh UI build with Vue.js 3 and TailwindCss 3.
It works only with Laravel 9+ as of Symfony Mailer replacement for previously used Swift Mailer.
You should update the dependency in your application's composer.json file:
masterro/laravel-mail-viewer to ^2.0
Run package migrations (requires doctrine/dbal to be installed):
php artisan migrateRun publish command:
php artisan mail-viewer:publish --viewsV2 uses separate date format for date and time, update these in your config/mail-viewer.php file
'date_format' => 'd.m.Y',
'time_format' => 'H:i:s',V2 allows prune old records easily using mail-viewer:prune command. You can add it to your Scheduler.
// Console/Kernel.php
$schedule->command('mail-viewer:prune')->daily();You can specify how many days data will be stored before pruning using config. Default value is 31 days.
'prune_older_than_days' => 31,From the command line, run:
composer require masterro/laravel-mail-viewer
php artisan mail-viewer:publish
You have to publish assets, and views, configs are optional.
php artisan migrate
All ongoing emails you can find on /_mail-viewer page.
You can review and change all the default configuration values in published config/mail-viewer.php file.
The package allows you to prune old records easily using mail-viewer:prune command. You can add it to your Scheduler.
// Console/Kernel.php
$schedule->command('mail-viewer:prune')->daily();