tompec/laravel-email-log
Composer 安装命令:
composer require tompec/laravel-email-log
包简介
A Laravel package to log outgoing emails
README 文档
README
laravel-email-log logs outgoing emails sent to your users.
If you use MailGun, you can also track deliveries, failures, opens and clicks.
Installation
Install the package via composer:
composer require tompec/laravel-email-log
If you use Laravel 5.5+, the package will register itself, otherwise, add this to your config/app.php
'providers' => [ Tompec\EmailLog\EmailLogServiceProvider::class, ],
Run the migration:
php artisan migrate
Configuration (optional)
Publish the configuration file:
php artisan vendor:publish --provider="Tompec\EmailLog\EmailLogServiceProvider"
Here's the content of the config file.
return [ /* * This is the name of the table that will be created by the migration. */ 'table_name' => 'email_log', /* * The model that will be attached to the email logs. */ 'recipient_model' => \App\User::class, /* * This is the name of the column that the `recipient_model` uses to store the email address. */ 'recipient_email_column' => 'email', /* * Whether or not you want to log emails that don't belong to any model */ 'log_unknown_recipients' => true, ];
If you want to get all the email logs for your a user, add this to your App\User.php file (or the model you chose as your recipient_model):
public function email_logs() { return $this->morphMany(\Tompec\EmailLog\EmailLog::class, 'recipient'); }
Then you can do App\User::find(1)->email_logs to retreive all the emails that this user has received.
Webhooks
If you use Mailgun, you can track these 4 events: delivered , opened, clicked, permanent_fail.
Add the following url as a new webhook.
https://www.yourdomain.com/email-log/mailgun
Laravel Nova
If you use Laravel Nova, you can create a new resource to view the content of the table:
php artisan nova:resource EmailLog
Then paste the content of this gist for a quick setup.
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email laravel-email-log@mail.tompec.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
tompec/laravel-email-log 适用场景与选型建议
tompec/laravel-email-log 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.44k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「tompec」 「laravel-email-log」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tompec/laravel-email-log 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tompec/laravel-email-log 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.44k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 49
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-01-04