creagia/laravel-web-mailer

Laravel Web Mailer

Fund package maintenance!
creagia

1.0.3 2024-03-04 12:22 UTC

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.

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

Inbox screenshot

Support us

Laradir banner

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.