Mailviewer enables you to view and filter mail that is sent by your Laravel application in the browser. The Analytics page gives you insight in the amount of mails sent sent by your application grouped by Notification.
Version | Release |
---|---|
11.x | ^3.0 |
10.x | ^3.0 |
This package tracks mails sent via Laravel's Mailables
and Notifications
.
composer require label84/laravel-mailviewer
php artisan vendor:publish --provider="Label84\MailViewer\MailViewerServiceProvider" --tag="config"
php artisan vendor:publish --provider="Label84\MailViewer\MailViewerServiceProvider" --tag="migrations"
To change the default views, you can publish them to your application.
php artisan vendor:publish --provider="Label84\MailViewer\MailViewerServiceProvider" --tag="views"
Run the migration command.
php artisan migrate
To preview the mails sent by your application visit: /admin/mailviewer
. You can change this url in the config file.
You can add MAILVIEWER_ENABLED=true
to your .env
file.
You can filter the mails in the overview with query parameters - example /admin/mailviewer?notification=WelcomeMail
.
Parameter | Value | Example |
---|---|---|
to= | [email protected] | |
cc= | [email protected] | |
bcc= | [email protected] | |
notification= | class basename of Notification | VerifyEmail |
from= | Carbon | 2 hours ago |
till= | Carbon | yesterday |
around= | Carbon | 2020-12-24 06:00 |
The 'notification' parameter only requires the class basename (ie. \Illuminate\Auth\Notifications\VerifyEmail = VerifyEmail).
The around parameter show all mails sent around the given time. By default is will show all mails sent 10 minutes before and 10 minutes after the given time. You can customize the number of minutes by adding an additional &d=X parameter where X is the number of minutes.
To preview the analytics page visit: /admin/mailviewer/analytics
. You can change this url in the config file.
On the analytics page you can view the number of mails sent per Notification and the latest time this notification was sent.
View all VerifyEmail mails to [email protected].
/admin/[email protected]¬ification=VerifyEmail
View all mails sent in the last 2 hours.
/admin/mailviewer?from=2 hours ago
In the config file you can add an array of Notification classes and an array of email addresses that should be excluded. Those notifications and email addresses won't be saved to the database.
composer analyse
composer test