Mail Web is a Laravel package which catches emails locally for debugging
Installation
Use the package manager composer to install Mail Web.
composer require appoly/mail-web
Usage
Run the migration
php artisan migrate
Publish the assets to your project using
php artisan vendor:publish --tag=mailweb-public --force
Publish the config to your project using
php artisan vendor:publish --tag=mailweb-config --force
Add MailSending to your EventServiceProvider.php
use Appoly\MailWeb\Http\Listeners\MailWebListener;
use Illuminate\Mail\Events\MessageSending;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
MessageSending::class => [
MailWebListener::class
]
];
To use Mail Web you need to add a Gate to your AuthServiceProvider. If you would like to limit the users that can access the route then use
public function boot()
{
Gate::define("view-mailweb", function ($user) {
return in_array($user->email, [
'[email protected]',
]);
});
}
Should you want to allow access to all users then change the above code to
Gate::define("view-mailweb", function ($user) {
return true;
});
To view emails then go to
{url}\mailweb
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.