Download the PHP package r0bdiabl0/laravel-email-tracker without Composer

On this page you can find all versions of the php package r0bdiabl0/laravel-email-tracker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-email-tracker

Laravel Email Tracker

Latest Version on Packagist Total Downloads License

A multi-provider email tracking and bounce management package for Laravel 11+ that provides unified tracking for opens, clicks, bounces, complaints, and deliveries across AWS SES, Resend, Postal, Mailgun, SendGrid, and Postmark. Includes optional suppression to automatically skip sending to problematic addresses.

Table of Contents

What This Package Does

What This Package Does NOT Do

Requirements

Installation

Run the install command:

This will:

  1. Publish the configuration file to config/email-tracker.php
  2. Publish the migrations
  3. Optionally run the migrations

Configuration

Environment Variables

Add these to your .env file:

Table Names

By default, tables are created without a prefix:

With a prefix like tracker:

Enable Providers

Enable only the providers you use:

Transport Configuration

The package provides custom Symfony transports for providers that need HTTP API access for full tracking support. Configure these in your config/mail.php:

Provider Transport Summary:

Provider Transport Type SDK Required
AWS SES Laravel built-in (ses) aws/aws-sdk-php (included)
Resend Package transport (resend) resend/resend-php (optional)
Postal Package transport (postal) postal/postal (optional)
Mailgun Symfony built-in (mailgun) symfony/mailgun-mailer
Postmark Symfony built-in (postmark) symfony/postmark-mailer
SendGrid SMTP None

Install optional SDKs as needed:

Using Multiple Providers

You can enable multiple providers simultaneously and switch between them per-send:

Each provider has its own webhook endpoint. When you receive bounce/complaint notifications, they'll be routed to the correct handler based on the URL:

The provider column in the database tracks which service sent each email, allowing you to query statistics by provider.

Basic Usage

Sending Tracked Emails

Using the TracksWithEmail Trait (Optional)

Add the trait to your Mailable for convenience methods:

Using the Notification Channel (Optional)

Webhook Setup

Your email provider will send event notifications (bounces, complaints, deliveries) to these webhook URLs. You must configure these URLs in each provider's dashboard.

Webhook URLs

Provider Webhook URL
AWS SES https://your-app.com/email-tracker/webhook/ses/bounce
https://your-app.com/email-tracker/webhook/ses/complaint
https://your-app.com/email-tracker/webhook/ses/delivery
Resend https://your-app.com/email-tracker/webhook/resend
Postal https://your-app.com/email-tracker/webhook/postal
Mailgun https://your-app.com/email-tracker/webhook/mailgun
SendGrid https://your-app.com/email-tracker/webhook/sendgrid
Postmark https://your-app.com/email-tracker/webhook/postmark

AWS SES Setup

  1. Create SNS topics for bounces, complaints, and deliveries in AWS Console
  2. Add HTTPS subscriptions pointing to your webhook URLs
  3. Configure your SES domain/email to publish to these SNS topics
  4. The package automatically validates SNS message signatures

Resend Setup

  1. Go to Resend Dashboard > Webhooks
  2. Add a new webhook pointing to https://your-app.com/email-tracker/webhook/resend
  3. Select events: email.bounced, email.complained, email.delivered
  4. Copy the signing secret (starts with whsec_) to your .env

Mailgun Setup

  1. Go to Mailgun Dashboard > Sending > Webhooks
  2. Add webhook URLs for Permanent Failures, Temporary Failures, and Delivered
  3. Copy your webhook signing key to your .env

SendGrid Setup

  1. Go to SendGrid Dashboard > Settings > Mail Settings > Event Webhook
  2. Set the HTTP POST URL to https://your-app.com/email-tracker/webhook/sendgrid
  3. Select events: Bounced, Spam Reports, Delivered
  4. Enable Event Webhook Security and copy the verification key

Postmark Setup

  1. Go to Postmark > Servers > Your Server > Webhooks
  2. Add webhooks for Bounces, Spam Complaints, and Deliveries
  3. Set the webhook URL and optionally configure Basic Auth for security

Postal Setup

  1. Go to your Postal server admin panel
  2. Add a webhook endpoint pointing to https://your-app.com/email-tracker/webhook/postal
  3. Configure the shared secret key in your .env

Security Considerations

Webhook Signature Validation

All providers support webhook signature validation to ensure requests are authentic:

Provider Validation Method Required Config
AWS SES SNS certificate validation Automatic
Resend Svix HMAC-SHA256 webhook_secret
Mailgun HMAC-SHA256 webhook_signing_key
SendGrid ECDSA P-256 verification_key
Postmark Header token or Basic Auth webhook_token
Postal Header token webhook_key

Important: In development, validation is skipped if no secret is configured. In production, always configure your webhook secrets.

Protecting Webhook Routes

The webhook routes are public by default (no auth middleware). This is required because email providers need to access them. Security is provided through signature validation.

If you need additional protection, you can:

  1. Configure IP allowlists in your web server (nginx/Apache)
  2. Add custom middleware in the config:

CSRF Protection

Webhook routes must be excluded from CSRF protection since they receive POST requests from external services. The package routes are loaded outside the web middleware group, but if your application applies CSRF middleware globally, you need to exclude the webhook routes.

Add to your bootstrap/app.php (Laravel 11+):

Or in app/Http/Middleware/VerifyCsrfToken.php (Laravel 10):

One-Click Unsubscribe (RFC 8058)

The package supports RFC 8058 compliant one-click unsubscribe headers, which are now required by Gmail, Yahoo, and other major email providers for bulk senders. This feature improves deliverability and helps you comply with sender requirements.

How It Works

  1. When enabled, the package adds List-Unsubscribe and List-Unsubscribe-Post headers to your emails
  2. Email clients show an "Unsubscribe" button in their UI
  3. When clicked, a POST request is sent to your app's signed unsubscribe endpoint
  4. The package validates the signature and fires an EmailUnsubscribeEvent
  5. You handle the business logic in your event listener

Enabling Unsubscribe Headers

Option 1: Global (All Tracked Emails)

Option 2: Per-Email

Configuration

Customizing the Unsubscribe URL

By default the package generates a non-expiring Laravel signed URL pointing at the email-tracker.unsubscribe route. Set unsubscribe.signature_expiration above 0 to make those links time-limited — not recommended, since a recipient who opens the email after the window can no longer unsubscribe.

To use a completely different URL scheme (for example a persistent token URL that does not depend on APP_KEY), bind your own implementation of UnsubscribeUrlGenerator:

The package always owns the RFC 8058 header assembly (List-Unsubscribe, List-Unsubscribe-Post, and the optional mailto: fallback) — you only supply the URL, so there is exactly one header path and no risk of duplicate List-Unsubscribe headers.

Handling Unsubscribe Events

Register a listener for the EmailUnsubscribeEvent:

CSRF Protection

The unsubscribe endpoint needs to be excluded from CSRF protection (it receives POST requests from external email clients):

Note: If you configured a custom route prefix via EMAIL_TRACKER_ROUTE_PREFIX, update the CSRF exclusion paths accordingly.

Security Recommendations

What This Feature Does NOT Do

Events

The package dispatches events for all tracking activities. Listen to these in your EventServiceProvider:

Example Listener

Suppression (Bounce Management)

Automatically skip sending to bounced or complained addresses. This is disabled by default - enable it to protect your sender reputation:

When enabled, suppression works automatically across all sending methods:

If a suppressed address is detected, an AddressSuppressedException is thrown with the email and reason.

Manual Suppression Checking

You can also check suppression manually:

Database Schema

The package creates the following tables (with optional prefix):

sent_emails

Column Type Description
id bigint Primary key
provider string Email provider (ses, resend, etc.)
message_id string Provider's message ID
email string Recipient email address
batch_id bigint Optional batch reference
sent_at timestamp When email was sent
delivered_at timestamp When delivery was confirmed
bounce_tracking boolean Whether bounce tracking is enabled
complaint_tracking boolean Whether complaint tracking is enabled
delivery_tracking boolean Whether delivery tracking is enabled

email_bounces

Column Type Description
id bigint Primary key
provider string Email provider
sent_email_id bigint Reference to sent email
type string Bounce type (Permanent/Transient)
email string Bounced email address
bounced_at timestamp When bounce occurred
metadata json Raw webhook payload (for diagnostic details)

email_complaints

Column Type Description
id bigint Primary key
provider string Email provider
sent_email_id bigint Reference to sent email
type string Complaint type (spam, etc.)
email string Complaining email address
complained_at timestamp When complaint occurred
metadata json Raw webhook payload (for diagnostic details)

email_opens

Column Type Description
id bigint Primary key
sent_email_id bigint Reference to sent email
beacon_identifier string Unique identifier for tracking pixel
opened_at timestamp When email was opened

email_links

Column Type Description
id bigint Primary key
sent_email_id bigint Reference to sent email
link_identifier string Unique identifier for link tracking
original_url text Original link URL
clicked boolean Whether link has been clicked
click_count integer Number of clicks

batches

Column Type Description
id bigint Primary key
name string Batch identifier

Metadata Storage Considerations

The metadata column in email_bounces and email_complaints tables can store raw webhook payloads from email providers. This provides valuable diagnostic information but is disabled by default.

Configuration:

Important: Even when store_metadata is false, the raw webhook payload is still available in event listeners via the metadata property. This allows you to process diagnostic information in real-time without persisting it to the database.

When to enable persistent storage:

When to keep disabled (default):

What metadata contains:

Storage considerations:

Privacy considerations:

Example cleanup job:

Querying Data

Migrating from juhasev/laravel-ses

If you're migrating from juhasev/laravel-ses:

The migration will:

Backwards Compatibility

The SesMail facade is aliased to EmailTracker:

Enable legacy routes to keep old webhook URLs working:

Admin Panel Plugins

Filament Plugin

For Filament v3/v4 users, install the companion plugin for dashboard widgets, statistics, and resource pages:

Features:

Register in your Filament panel provider:

See r0bdiabl0/laravel-email-tracker-filament for full documentation.

Nova Plugin

For Laravel Nova v4/v5 users, install the companion plugin for resource management:

Features:

The resources are auto-registered. See r0bdiabl0/laravel-email-tracker-nova for customization options.

Laravel Boost AI Integration

This package includes Laravel Boost AI guidelines and skills to help AI assistants generate correct code for your email tracking implementation.

When you run php artisan boost:install in your Laravel application, Boost automatically loads:

No additional configuration required - Boost discovers the package's AI resources automatically.

Extending

Custom Providers

This package is fully extensible. You can add support for any email provider by implementing your own webhook handler.

Step 1: Create your provider class

Extend AbstractProvider which implements EmailProviderInterface:

Step 2: Register your provider

In your AppServiceProvider or a dedicated service provider:

Step 3: Add configuration (optional)

Step 4: Configure webhooks in your email provider

Your custom provider's webhook endpoint is automatically registered at:

Configure this URL in your email provider's dashboard/settings:

  1. Set the webhook URL to https://your-app.com/email-tracker/webhook/custom-smtp
  2. Select event types to receive (bounces, complaints, deliveries, opens, clicks)
  3. Configure authentication - if your provider supports webhook signing:
    • Copy the signing secret/key from your provider
    • Add it to your .env: EMAIL_TRACKER_CUSTOM_SMTP_SECRET=your-secret-here
  4. Test the webhook - most providers have a "send test" feature

The package handles routing automatically - any POST request to /email-tracker/webhook/{provider-name} will be routed to your provider's handleWebhook() method.

AbstractProvider Helper Methods

The AbstractProvider base class provides useful helper methods:

Example using the helper methods in your handleWebhook():

Custom Models

Override default models:

Your custom model should extend the package model or implement the contract:

Testing

Troubleshooting

Webhooks not receiving data

  1. Verify the webhook URL is accessible from the internet
  2. Check your web server logs for incoming requests
  3. Enable debug logging: EMAIL_TRACKER_DEBUG=true
  4. Verify signature validation secrets are correct
  5. Check Laravel logs for validation errors

Open tracking not working

  1. Open tracking requires HTML emails (not plain text)
  2. Many email clients block tracking pixels by default
  3. Gmail, Apple Mail, and others may proxy images
  4. Consider open tracking as approximate data only

Message IDs not matching

  1. Ensure you're storing the message ID from the send response
  2. Different providers format message IDs differently
  3. Check that the same message ID format is used in webhooks

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with tests
  4. Run composer test and composer analyse
  5. Submit a pull request

For bugs and feature requests, please open an issue.

License

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

Credits


All versions of laravel-email-tracker with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/mail Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
illuminate/notifications Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
aws/aws-sdk-php Version ^3.288
guzzlehttp/guzzle Version ^7.8
aws/aws-php-sns-message-validator Version ^1.7
nesbot/carbon Version ^3.0
voku/simple_html_dom Version ^4.8
ramsey/uuid Version ^4.7
symfony/psr-http-message-bridge Version ^7.0
nyholm/psr7 Version ^1.8
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package r0bdiabl0/laravel-email-tracker contains the following files

Loading the files please wait ...