label84/laravel-mailviewer
Composer 安装命令:
composer require label84/laravel-mailviewer
包简介
View mails sent by Laravel in the browser
README 文档
README
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.
Laravel Support
| Version | Release |
|---|---|
| 12.x | ^3.4 |
| 12.x | ^3.4 |
| 11.x | ^3.0 |
Limitations
This package tracks mails sent via Laravel's Mailables and Notifications.
Installation
1. Require package
composer require label84/laravel-mailviewer
2. Publish the config file and migration
php artisan vendor:publish --provider="Label84\MailViewer\MailViewerServiceProvider" --tag="config" php artisan vendor:publish --provider="Label84\MailViewer\MailViewerServiceProvider" --tag="migrations"
2.1 Publish the views (optional)
To change the default views, you can publish them to your application.
php artisan vendor:publish --provider="Label84\MailViewer\MailViewerServiceProvider" --tag="views"
3. Run migrations
Run the migration command.
php artisan migrate
Usage
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.
Filters
You can filter the mails in the overview with query parameters - example /admin/mailviewer?notification=WelcomeMail.
| Parameter | Value | Example |
|---|---|---|
| to= | info@example.com | |
| cc= | info@example.com | |
| bcc= | info@example.com | |
| 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.
Analytics
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.
Examples
Example #1
View all VerifyEmail mails to info@example.com.
/admin/mailviewer?to=info@example.com¬ification=VerifyEmail
Example #2
View all mails sent in the last 2 hours.
/admin/mailviewer?from=2 hours ago
Exclusion list
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.
Tests
composer pint
composer analyse
composer test
License
label84/laravel-mailviewer 适用场景与选型建议
label84/laravel-mailviewer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 31.58k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2020 年 12 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 label84/laravel-mailviewer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 label84/laravel-mailviewer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 31.58k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 15
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-22

