PHP code example of michaelgrimshaw / laravel-email-tracker

1. Go to this page and download the library: Download michaelgrimshaw/laravel-email-tracker library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

michaelgrimshaw / laravel-email-tracker example snippets


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

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


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

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

class User extends Authenticatable
{
    use TrackableTrait;

    // ...
}

linkedTo(object)

category(string)

tracked(bool)

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

// 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'
bash
php artisan migrate
bash
php artisan vendor:publish --provider="MichaelGrimshaw\MailTracker\MailTrackerServiceProvider" --tag="config"