定制 tompec/laravel-email-log 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tompec/laravel-email-log

Composer 安装命令:

composer require tompec/laravel-email-log

包简介

A Laravel package to log outgoing emails

README 文档

README

Latest Version on Packagist Build Status Quality Score Coverage StyleCI Total Downloads

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.

统计信息

  • 总下载量: 1.44k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固