topoff/laravel-mail-manager

Manages mail templates and mail sending in Laravel

Maintainers

Package info

github.com/topoff/laravel-mail-manager

pkg:composer/topoff/laravel-mail-manager

Statistics

Installs: 82

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package provides a comprehensive solution for managing mail templates and mail sending in Laravel applications.

Installation

You can install the package via composer:

composer require topoff/laravel-mail-manager

You can publish the config file with:

php artisan vendor:publish --tag="mail-manager-config"

Usage

Documentation coming soon.

SES/SNS Auto Setup (SES v2 Configuration Sets)

The package can provision SES/SNS tracking resources via AWS API:

  • SES Configuration Set
  • SES Event Destination (SNS)
  • SNS Topic policy for SES publish
  • SNS HTTPS subscription to mail-manager.tracking.sns

Enable it in config:

'ses_sns' => [
    'enabled' => true,
],

Then run:

php artisan mail-manager:ses-sns:setup-tracking
php artisan mail-manager:ses-sns:check-tracking
php artisan mail-manager:ses-sns:setup-sending
php artisan mail-manager:ses-sns:check-sending
php artisan mail-manager:ses-sns:teardown --force

In Nova (Message Types resource), use action Setup SES/SNS Tracking to run setup and open the status/check page.

BCC Recipient Filtering

When BCC is added to an email (e.g. via AddBccToEmailsListener), both the TO and BCC recipients share the same SES message ID. SNS event notifications (delivery, bounce, complaint) are matched to Message records by tracking_message_id, so without filtering, events for the BCC recipient would corrupt the original recipient's tracking data (e.g. a BCC bounce setting success: false on the original message).

The SNS event jobs (RecordDeliveryJob, RecordBounceJob, RecordComplaintJob) guard against this by comparing the event's recipient email(s) against the message's tracking_recipient_email. If they don't match, the event is skipped for that message. This comparison is case-insensitive and null-safe — messages without a tracking_recipient_email process all events as before.

RecordRejectJob is unaffected since reject notifications carry no per-recipient data.

Nova Integration

If Laravel Nova is installed, the package can auto-register a tracked messages resource with preview and resend actions.

Configuration keys:

  • mail-manager.tracking.nova.enabled
  • mail-manager.tracking.nova.register_resource
  • mail-manager.tracking.nova.resource
  • mail-manager.tracking.nova.preview_route

The preview action uses a temporary signed URL and the package route mail-manager.tracking.nova.preview.

Development

Code Quality Tools

This package uses several tools to maintain code quality:

Laravel Pint (Code Formatting)

Format code according to Laravel standards:

composer format

Rector (Automated Refactoring)

Preview potential code improvements:

composer rector-dry

Apply automated refactorings:

composer rector

PHPStan (Static Analysis)

Run static analysis:

composer analyse

Run All Quality Checks

composer lint

This runs both Pint and PHPStan.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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