PHPackages                             basementdevs/filament-better-mails - 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. basementdevs/filament-better-mails

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

basementdevs/filament-better-mails
==================================

This is my package filament-better-mails

5.1.6(1mo ago)37.1k↑346.2%1MITPHPPHP ^8.3CI failing

Since Nov 21Pushed 1mo agoCompare

[ Source](https://github.com/basementdevs/filament-better-mail)[ Packagist](https://packagist.org/packages/basementdevs/filament-better-mails)[ Docs](https://github.com/basementdevs/filament-better-mails)[ GitHub Sponsors]()[ RSS](/packages/basementdevs-filament-better-mails/feed)WikiDiscussions 5.x Synced 3w ago

READMEChangelog (8)Dependencies (45)Versions (18)Used By (0)

Filament Better Mails
=====================

[](#filament-better-mails)

[![Latest Version on Packagist](https://camo.githubusercontent.com/291729f6ada45c59aee516ccfbc35fa492345934bc3744cd6222632be0eb4b29/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626173656d656e74646576732f66696c616d656e742d6265747465722d6d61696c732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/basementdevs/filament-better-mails)[![GitHub Tests Action Status](https://camo.githubusercontent.com/36d01d82961fddb2eac77ecece3a034f83e5da0089f62083f2f9e541530c75d1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f626173656d656e74646576732f66696c616d656e742d6265747465722d6d61696c732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/basementdevs/filament-better-mails/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/251f01f272df150050f38f789b873b8ab8212889c3738f39fe8cc407d5decce9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f626173656d656e74646576732f66696c616d656e742d6265747465722d6d61696c732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/basementdevs/filament-better-mails/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/9454ef0e1d1dc70f377ba85813c999967450896762a9043b6cabd50e2806bf38/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626173656d656e74646576732f66696c616d656e742d6265747465722d6d61696c732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/basementdevs/filament-better-mails)

A Filament v5 plugin that automatically logs every outgoing email, tracks delivery events via provider webhooks, and gives you a full-featured admin panel to browse, preview, and resend emails.

Features
--------

[](#features)

- **Zero-config email logging** -- every outgoing email is captured automatically
- **Webhook-based delivery tracking** -- delivered, opened, clicked, bounced, complained, and more
- **Email preview** -- rendered HTML, raw HTML source, and plain text views
- **Resend emails** -- individually or in bulk with custom recipients
- **Send test emails** -- simple or with attachments, directly from the admin panel
- **Attachment storage** -- stored to disk with download support
- **Dashboard stats widget** -- delivery, open, click, and bounce rates at a glance
- **Fully config-driven** -- customize table names, swap models, configure resource navigation
- **Auto-pruning** -- schedule cleanup of old email records
- **Dark mode support**

Requirements
------------

[](#requirements)

- PHP 8.3+
- Laravel 12.x or 13.x
- Filament 5.x

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require basementdevs/filament-better-mails
```

Publish and run the migrations:

```
php artisan vendor:publish --tag="filament-better-mails-migrations"
php artisan migrate
```

Publish the config file:

```
php artisan vendor:publish --tag="filament-better-mails-config"
```

Setup
-----

[](#setup)

### 1. Register the Plugin

[](#1-register-the-plugin)

Add the plugin to your Filament panel provider:

```
use Basement\BetterMails\Filament\FilamentBetterEmailPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugin(FilamentBetterEmailPlugin::make());
}
```

### 2. Configure Your Email Provider

[](#2-configure-your-email-provider)

Set your provider credentials in `.env`:

```
MAIL_MAILER=resend
RESEND_API_KEY=your-api-key
RESEND_WEBHOOK_SECRET=your-webhook-secret
MAILS_WEBHOOK_PROVIDER=resend
```

### 3. Register Webhook URL

[](#3-register-webhook-url)

Point your email provider's webhook settings to:

```
POST https://your-app.com/webhook/resend

```

This route is automatically registered and CSRF-exempt.

How It Works
------------

[](#how-it-works)

### Email Capture Flow

[](#email-capture-flow)

The package hooks into Laravel's mail events automatically. No changes to your existing mail code are required.

```
 YOUR APP                                  BETTER MAILS
  |                                           |
  |  Mail::send(new OrderConfirmation)        |
  | ----------------------------------------> |
  |                                           |  BeforeSendingMailListener
  |                                           |  - Generate tracking UUID
  |                                           |  - Store email record (subject, body, recipients)
  |                                           |  - Store attachments to disk
  |                                           |  - Inject UUID into email headers
  |                                           |
  |                                           |  AfterSendingMailListener
  |                                           |  - Mark record as sent
  |                                           |  - Create "Sent" event
  |                                           |

```

### Webhook Tracking Flow

[](#webhook-tracking-flow)

When your email provider processes the email, it sends delivery events back:

```
 YOUR APP                   RESEND                    RECIPIENT
  |                           |                          |
  |  -- sends email --------> |  -- delivers ----------> |
  |                           |                          |
  |                           |
