actinity / mailtrapper
Mailtrapper for Laravel
Installs: 6 962
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:Vue
README
This is a package for Laravel and Vue that captures emails generated by the framework and renders them into an onscreen email viewer.
Think Mailtrap, but inline within the application itself, with no need to login to a separate service.
What it does
Overrides the default mail transport in Laravel to save rendered emails to a database table.
The Recipient, Subject and HTML body are all captured.
The Vue component adds a mail icon at the top right, polls every few seconds for recent messages, and flashes when a new message is available.
Clicking on the icon opens an onscreen inbox. Because all emails are captured, this includes all emails generated to any recipient.
Requirements for use
- Laravel 9+
- Vue 3+
- axios
- A logged in user accessible at
auth()->user()
[DEFAULT]
Authentication
By default the library requires an authenticated user and uses
the web
middleware group. You can customise this by publishing
the config and modifying the middleware
to suit your needs.
Installation
composer require actinity/mailtrapper
Import the component from vendor/actinity/mailtrapper/src/components/Mailtrapper.vue
Add the <mailtrapper></mailtrapper>
tag to a view or
your main SPA component.
Run php artisan migrate
to set up the table
Set MAIL_MAILER=trapper
in your .env
Emptying the database
If you define a gate called mailtrapper:empty
, the interface
will include an 'Empty' button for matching users that allows them
to empty the shared mailbox.