Download the PHP package jeylabs/mail-tracker without Composer
On this page you can find all versions of the php package jeylabs/mail-tracker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jeylabs/mail-tracker
More information about jeylabs/mail-tracker
Files in jeylabs/mail-tracker
Package mail-tracker
Short Description 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.
License MIT
Informations about the package mail-tracker
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 < 5.3.23
Install (Laravel)
Via Composer
Add the following to the providers array in config/app.php:
Publish the config file and migration
Run the migration
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
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:
Then you must register the event in your \App\Providers\EventServiceProvider $listen array:
Passing data to the event listeners
Often times you may need to link a sent email to another model. The best way to handle this is to add a header to your outgoing email that you can retrieve in your event listener. Here is an example:
and then in your event listener:
Note that the headers you are attaching to the email are actually going out with the message, so do not store any data that you wouldn't want to expose to your email recipients.
Amazon SES features
If you use Amazon SES, you can add some additional information to your tracking. To set up the SES callbacks, first set up SES notifications under your domain in the SES control panel. Then subscribe to the topic by going to the admin panel of the notification topic and creating a subscription for the URL you copied from the admin page. The system should immediately respond to the subscription request. If you like, you can use multiple subscriptions (i.e. one for delivery, one for bounces). See above for events that are fired on a failed message.
All versions of mail-tracker with dependencies
guzzlehttp/guzzle Version ^5.3.1|^6.2.1
illuminate/support Version ~5.1
aws/aws-sdk-php-laravel Version ~3.0
aws/aws-php-sns-message-validator Version ^1.1
php Version ~5.5|~7.0