tjvb / laravel-mail-catchall
Catch all mail in Laravel and redirect it to a configured email address
Requires
- php: ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0
- laravel/framework: ^9.0 || ^10.0 || ^11.0
- psr/log: ^1.0 || ^2.0 || ^3.0
- thecodingmachine/safe: ^2.5
Requires (Dev)
- fakerphp/faker: ^1.11
- friendsofphp/php-cs-fixer: ^3.52
- infection/infection: ^0.25.6 || ^0.26.0 || ^0.27.0
- mockery/mockery: ^1.0
- orchestra/testbench: ^7.0 || ^8.0 || ^9.0
- phpmd/phpmd: ^2.13
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^8.0 || ^9.0 || ^10.0
- slevomat/coding-standard: ^8.15
- squizlabs/php_codesniffer: ^3.9
- symplify/easy-coding-standard: ^12.1
- thecodingmachine/phpstan-safe-rule: ^1.2
README
Why
The target is to catch all the mail send by Laravel and send it to a configured email address. We found it useful to use it for acceptance environments where the client can check all the mail that is send by the application. This also catch the email that is send by a queue runner or an artisan command.
Alternative
If you just want to see the mail directly and don't use a queue or artisan task to send the mail. You can use the Laravel Mail Preview Driver from Mohamed Said https://github.com/themsaid/laravel-mail-preview
Installation
You can install the Laravel Mail Catcher with composer with the command: composer require tjvb/laravel-mail-catchall
Manual register the service provider.
If you disable the package discovery you need to add TJVB\MailCatchall\MailCatchallServiceProvider::class,
to the providers array in config/app.php
Publish the config file
Publish the config file with php artisan vendor:publish --provider="TJVB\MailCatchall\MailCatchallServiceProvider"
Config
Set the MAILCATCHALL_ENABLED
env variable (most used version is to set it in the .env file) to true
Set the MAILCATCHALL_RECEIVER
env variable with the email address of the receiver.
Optional config
You have more options to change in the mailcatchall.php config file. You can enable or disable the appending of the receivers to the HTML or text mails.
The package blade views are published to your views directory (resources/views/vendor/mailcatchall) so that is the place to change the displaying.
Changelog
We (try to) document all the changes in CHANGELOG so read it for more information.
Version compatibility
Laravel Mail Catchall | Laravel | PHP |
---|---|---|
1.0 | 5.0 - 5.6 | 7.0 - 7.2 |
1.1 | 5.0 - 5.7 | 7.0 - 7.2 |
2.0 | 5.7 - 5.8 | 7.2 |
2.1 | 5.7 - 5.8 | 7.2 - 7.3 |
2.2 | 5.7 - 6 | 7.2 - 7.3 |
2.3 | 5.7 - 7 | 7.2 - 7.4 |
3.0 | 6 - 8 | 7.3 - 7.4 |
3.1 | 6 - 8 | 7.3 - 8.0 |
3.2 | 6 - 8 | 7.3 - 8.1 |
4.0 | 9 | 8.0 - 8.1 |
4.1 | 9 | 8.0 - 8.2 |
4.2 | 9 - 10 | 8.0 - 8.2 |
4.3 | 9 - 10 | 8.0 - 8.3 |
4.4 | 9 - 11 | 8.0 - 8.3 |
Contributing
You are welcome to contribute, read about it in CONTRIBUTING
Code of Conduct
We have a code of conduct, and suspect everybody who want to involve in this project to respect it. CODE OF CONDUCT
License
The MIT License (MIT). Please see License File for more information.