creagia / laravel-web-mailer
Laravel Web Mailer
Fund package maintenance!
creagia
Installs: 8 584
Dependents: 0
Suggesters: 0
Security: 0
Stars: 66
Watchers: 2
Forks: 4
Open Issues: 0
Requires
- php: ^8.1
- illuminate/contracts: ^9.0|^10.0|^11.0
- spatie/laravel-package-tools: ^1.9.2
- symfony/mime: ^6.1|^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- nunomaduro/collision: ^6.0|^8.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0|^8.0|^9.0
- pestphp/pest: ^1.21|^2.34
- pestphp/pest-plugin-laravel: ^1.1|^2.3
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5|^10.5
README
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.
Support us
Requirements
This package requires PHP 8.1 and Laravel 9. If you need compatibility with older versions, check the alternatives section.
Installation
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"
Inbox URL
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"
Route protection
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.
Delete all stored emails
php artisan laravel-web-mailer:clear-all
Delete stored emails older than N days
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.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Alternatives
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.