承接 michaelgrimshaw/laravel-email-tracker 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

michaelgrimshaw/laravel-email-tracker

Composer 安装命令:

composer require michaelgrimshaw/laravel-email-tracker

包简介

A package to track sent mail and listen to webhook events

README 文档

README

This package allows you to track sent mail and query sent mail statistics.

Once installed you can do stuff like this:

$user  = User::find(1);
$order = Order::find(1);
Mail::to($user)
    ->linkedTo($order)
    ->category('Order Verification')
    ->send(new testMail()));

By adding a trait you can access history sending history for a recipient or model.

// Get emails history sent to a user
$user->recipientHistory;
// Get emails history linked to a order
$order->mailableHistory;

Installation

Laravel

This package can be used in Laravel 5.5 or higher.

You can install the package via composer:

composer require michaelgrimshaw/laravel-email-tracker

In Laravel 5.5 the service provider will automatically get registered. In older versions of the framework just add the service provider in config/app.php file:

'providers' => [
    // ...
    MichaelGrimshaw\MailTracker\MailTrackerServiceProvider::class,
];
'aliases' => [
    // ...
    'Mail' => MichaelGrimshaw\MailTracker\Facades\Mail::class,
    'MailStats' => MichaelGrimshaw\MailTracker\Facades\MailStats::class,
];

You can create the mail history tables by running the migrations:

php artisan migrate

You can publish the config file with:

php artisan vendor:publish --provider="MichaelGrimshaw\MailTracker\MailTrackerServiceProvider" --tag="config"

Usage

First, add the MichaelGrimshaw\MailTracker\TrackableTrait trait to your User model(s) and link model(s):

use Illuminate\Foundation\Auth\User as Authenticatable;
use MichaelGrimshaw\MailTracker\TrackableTrait;

class User extends Authenticatable
{
    use TrackableTrait;

    // ...
}

Methods

This now gives you access to extra functions when sending which can be used to control the tracking.

linkedTo(object)

Pass in a model object to link the mail.

category(string)

Pass a string to add a category to the tracked mail.

tracked(bool)

As default, mail will always be tracked. You can use the tracked method to turn tracking on or off.

Tracking Events

The default webhook url is /api/email-tracker/event-hook. You can customise the route:

Route::post('custome-route', MailTrackerController::class . '@processEvent');

When the webhook is processed one of the following events are called:

// Events
'mail.event'
'mail.processed'
'mail.dropped'
'mail.delivered'
'mail.deferred'
'mail.bounce'
'mail.open'
'mail.click'
'mail.spamreport'
'mail.group_unsubscribe'
'mail.group_resubscribe'

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 hello@michaelgrimshaw.co.uk instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 1.84k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 0
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固