PHPackages                             jeylabs/mail-tracker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. jeylabs/mail-tracker

ActivePackage[Mail &amp; Notifications](/categories/mail)

jeylabs/mail-tracker
====================

MailTracker will hook into all outgoing emails from Laravel and inject a tracking code into it. It will also store the rendered email in the database. There is also an interface to view sent emails.

1.0.9(8y ago)174.3kMITPHPPHP ~5.5|~7.0

Since Feb 1Pushed 8y ago3 watchersCompare

[ Source](https://github.com/jeylabs/mail-tracker)[ Packagist](https://packagist.org/packages/jeylabs/mail-tracker)[ RSS](/packages/jeylabs-mail-tracker/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (10)Dependencies (5)Versions (11)Used By (0)

MailTracker
===========

[](#mailtracker)

MailTracker will hook into all outgoing emails from Laravel and inject a tracking code into it. It will also store the rendered email in the database. There is also an interface to view sent emails.

NOTE: For Laravel &lt; 5.3.23
-----------------------------

[](#note-for-laravel--5323)

Install (Laravel)
-----------------

[](#install-laravel)

Via Composer

```
$ composer require jeylabs/mail-tracker
```

Add the following to the providers array in config/app.php:

```
Jeylabs\MailTracker\MailTrackerServiceProvider::class,
```

Publish the config file and migration

```
$ php artisan vendor:publish
```

Run the migration

```
$ php artisan migrate
```

Usage
-----

[](#usage)

Once installed, all outgoing mail will be logged to the database. The following config options are available in config/mail-tracker.php:

- **track-open**: set to true to inject a tracking pixel into all outgoing html emails.
- **track-click**: set to true to rewrite all anchor href links to include a tracking link. The link will take the user back to your website which will then redirect them to the final destination after logging the click.
- **expire-days**: How long in days that an email should be retained in your database. If you are sending a lot of mail, you probably want it to eventually expire. Set it to zero to never purge old emails from the database.
- **route**: The route information for the tracking URLs. Set the prefix and middlware as desired.
- **date-format**: You can define the format to show dates in the Admin Panel.

Events
------

[](#events)

When an email is sent, viewed, or a link is clicked, its tracking information is counted in the database using the Jeylabs\\MailTracker\\Model\\SentEmail model. You may want to do additional processing on these events, so an event is fired in these cases:

- Jeylabs\\MailTracker\\Events\\EmailSentEvent
- Jeylabs\\MailTracker\\Events\\ViewEmailEvent
- Jeylabs\\MailTracker\\Events\\LinkClickedEvent

If you are using the Amazon SNS notification system, an event is fired when you receive a permanent bounce. You may want to mark the email as bad or remove it from your database.

- Jeylabs\\MailTracker\\Events\\PermanentBouncedMessageEvent

To install an event listener, you will want to create a file like the following:

```
