A Laravel package that provides a complete implementation to track mails, starting to send the mail and receiving back mail's events by webhooks, currently the supported mailer is Resend, and a Filament v4 resource to view sent mails in your admin panel. It ships with:
- Language: PHP 8.3
- Framework: Laravel (Illuminate 12.x APIs)
- Admin: Filament v4
- Package manager: Composer
- Testing: Pest + Orchestra Testbench
- PHP ^8.3
- Laravel 12.x compatible application
- Filament ^4.0 installed in the host app
- Composer
You can install the package via composer:
composer require basementdevs/filament-better-mailsYou can publish and run the migrations with:
php artisan vendor:publish --tag="filament-better-mails-migrations"
php artisan migrateYou can publish the config file with:
php artisan vendor:publish --tag="filament-better-mails-config"This is the contents of the published config file:
return [
'mails' => [
'models' => [
'mail' => BetterEmail::class,
'event' => BetterEmailEvent::class,
'attachment' => BetterEmailAttachment::class,
],
'database' => [
'tables' => [
'mails' => 'mails',
'attachments' => 'mail_attachments',
'events' => 'mail_events',
'polymorph' => 'mailables',
],
'pruning' => [
'enabled' => false,
'after' => 30, // days
],
],
'headers' => [
'key' => 'X-Better-Mails-Event-ID'
],
'logging' => [
'attachments' => [
'enabled' => env('MAILS_LOGGING_ATTACHMENTS_ENABLED', true),
'disk' => env('FILESYSTEM_DISK', 'local'),
'root' => 'mails/attachments',
],
]
],
'webhooks' => [
'provider' => env('MAILS_WEBHOOK_PROVIDER', 'resend'),
'drivers' => [
'resend' => [
'driver' => ResendDriver::class,
'key_secret' => env('RESEND_WEBHOOK_SECRET', ''),
],
]
]
];Resend credentials and defaults are required by your application. The following are commonly used; verify in your project:
MAIL_MAILER=resend
RESEND_API_KEY=
RESEND_WEBHOOK_SECRET=Optionally, you can publish the views using
php artisan vendor:publish --tag="filament-better-mails-views"To use the Filament Resource you must add the FilamentBetterEmailPlugin at your panel provider.
use Basement\BetterMails\Filament\FilamentBetterEmailPlugin;
->plugins([
FilamentBetterEmailPlugin::make(),
])The resource track all mails sent based on their status, also has a widget and actions to resend this mails again.
composer testPlease see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.