Add an inbox screen to your application to monitor all outgoing emails.
This application is still in development and could implement breaking changes. Please use at your own risk.
You can install the package with composer
composer require justijndepover/laravel-inbox
After the installation, you have to publish the assets and perform the migration.
php artisan inbox:install --migration
If needed, you can also publish the config file immediately
php artisan inbox:install --config
This is the config file
return [
/*
* This setting determines if the Laravel Inbox package should Listen
* to Sending mail events.
*/
'listener_enabled' => (config('app.env') != 'production'),
/*
* This setting determines if the Laravel Inbox package should open up
* the endpoint to view the inbox application.
*/
'application_enabled' => (config('app.env') != 'production'),
/*
* This is the URI path where Laravel Inbox will be accessible from.
*/
'path' => 'inbox',
/*
* These middleware will get attached onto each Laravel Inbox route, giving you
* the chance to add your own middleware to this list or change any of
* the existing middleware. Or, you can simply stick with this list.
*/
'middleware' => ['web'],
];
The application will expose an endpoint at /inbox
.
By default, the package only works if your application environment is not set to production. You can change this behaviour by overwriting the inbox.listener_enabled
and inbox.application_enabled
setting.
The /inbox
endpoint is available to everyone. If you'd like to protect this route, you can do so by registering the following gate.
use Illuminate\Support\Facades\Gate;
Gate::define('viewInbox', function ($user) {
// your logic here
return $user->isAdmin();
});
A good place to do this is in your AuthServiceProvider
that ships with Laravel by default.
The main purpose for creating this package was to provide an alternative to mailtrap. That's also why the package only works if the application is not in production mode.
If you want to use the package for the same reason, it's recommended to set your mail driver to log
inside your env file, to prevent your application from actually sending emails.
MAIL_MAILER=log
If you find any security related issues, please open an issue or contact me directly at justijndepover@gmail.com.
If you wish to make any changes or improvements to the package, feel free to make a pull request.
The MIT License (MIT). Please see License File for more information.