Listens to Mail send event, and saves the information to database as backup/log
smajohusic/laravel-mail-logger is a Laravel package for listens to mail send event, and saves the information to database as backup/log.
It currently has 4 GitHub stars and 2.077 downloads on Packagist (latest version 1.0.1).
Install it with composer require smajohusic/laravel-mail-logger.
Discover more Laravel packages by smajohusic
or browse all Laravel packages to compare alternatives.
Last updated
Mail logger has one purpose, save mail before they are sent from your app. This enables you to have backup of mail and a overview if something goes wrong.
This package listens to the MessageSending event fired from Mailer. The listener will dispatch a job, then save the needed form information, event, route and recipient to the database.
This package also supports auto deleting. You can define how long the the app should keep the logs by defining days in the config file.
composer require smajohusic/laravel-mail-logger
Package is automatically discovered and registered via Laravel's automatic service provider registration.
composer require smajohusic/laravel-mail-loggerSmajo\MailLogger\MailLogServiceProvider::class to providers in app.phpphp artisan vendor:publish --provider="Smajo\MailLogger\MailLogServiceProvider"php artisan migrate to generate the mail-logger tableCron job
To enable auto-deleting you will need to set up a cron job that runs
php artisan schedule:run
By default the auto-deleting is disabled. To enable it set
'enableAutoDeletion' => true,
You can set how long the logs should be stored in the database by giving amount in days.
'keepLogsForDays' => 30,
To make it easier to find mails, you can define all "to" fields your app uses in forms. This will then find the user e-mail in the request, and save it as the "sender" field.
'toEmailAddresses' => [
'email',
'e-mail',
'to',
]