This package contains a web mailer which will catch all the sent emails. Then, you can view it visiting the route /web-inbox
.
The emails will be stored as a file in the storage folder.
This package requires PHP 8.1 and Laravel 9. If you need compatibility with older versions, check the alternatives section.
You can install the package via composer:
composer require creagia/laravel-web-mailer
After that, open your config/mail.php
file and add the web mailer entry in the mailers
configuration array.
'mailers' => [
// ...
'web' => [
'transport' => 'web',
],
],
Finally, you can enable the web mailer setting the defined mailer in your .env file:
MAIL_MAILER=web
We recommend you to publish the configuration file to be able to perform some customizations
php artisan vendor:publish --tag="web-mailer-config"
The default URL to view the emails is /web-inbox
. You can change it, adding the below entry to your .env file:
WEB_MAILER_ROUTE_PREFIX="your-custom-url"
By default, the inbox URL is authorized for everybody who has the link. If you need to add some protection, you can modify the middleware
array on the config/web-mailer.php
file.
php artisan laravel-web-mailer:clear-all
php artisan laravel-web-mailer:cleanup
You can run or schedule the command laravel-web-mailer:cleanup
to delete the emails older than N days. By default, it will delete the emails older than 7 days. You can customize the number of days changing the delete_emails_older_than_days
parameter on the config/web-mailer.php
file.
composer test
Please 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.