View and inspect all emails sent from your Laravel application.
Laravel Email Viewer is a package that allows you to view all emails sent from you application in the browser. This allows you to ensure your application has actually sent the mail. When using log as an email driver for your local or staging environment, you can inspect emails without the need for external tools like Mailtrap or Mailhog, so emails never have to leave your server at all.
- Log all application emails to a storage disk or database table
- Inspect HTML, attachments and email headers
- Packed with a simple Blade UI and a Vue.js/JSON controller
- Easily integrate in your existing application
https://axyr.gitbook.io/laravel-email-viewer
Outgoing emails will be automatically copied to a local disk or table, but you can work with this package manually as well with the Emails facade:
<?php
use Axyr\EmailViewer\Facades\Emails;
Emails::create($mimeMessage);
Emails::find($fileNameOrId);
Emails::delete($fileNameOrId);
Emails::paginate(10);
Emails::prune();
Emails::server('database')->get();
This package requires the PECL mailparse extension
Run the composer install command from the terminal:
composer require axyr/laravel-email-viewer
Publish the database migration and configuration file:
php artisan vendor:publish --provider="Axyr\EmailViewer\EmailViewerServiceProvider"
By default the package provides a set of routes for the Blade UI and the Vue UI. You can disabled them in the config file.
You can access the Blade UI by visiting:
https://your-host.tld/emails
To send a test email the package provides a simple Test command.
By default it will send to the laraval config value mail.from.address
php artisan email-viewer:send-test [email protected] [email protected]
For further information and customisation, visit our documentation page: