appoly/mail-web

Catch your outgoing emails within your project making it easier to test and share

Fund package maintenance!
appoly
Patreon

Installs: 3 302

Dependents: 0

Suggesters: 0

Security: 0

Stars: 75

Watchers: 4

Forks: 13

Open Issues: 0

Language:Blade

5.0.2 2024-03-28 16:00 UTC

README

MailWeb is a Laravel package designed to help developers with emails. With MailWeb you can effortlessly catch and view your application's outgoing emails. This allows developers to quickly see, debug and share emails.

Total Downloads Latest Stable Version License

68747470733a2f2f7777772e6170706f6c792e636f2e756b2f6170702f75706c6f6164732f323032342f30332f53637265656e73686f742d323032342d30332d30312d61742d31362e33382e30362e706e67

Features

  • Outgoing Email Capture: Intercept outgoing emails from your Laravel application seamlessly.
  • Tailwind UI: Enjoy a sleek and responsive user interface crafted with Tailwind CSS.
  • Email Viewing: Easily view captured emails within the Mail Web dashboard.
  • Shareable Links: Generate shareable links for email previews, facilitating collaboration and debugging.
  • Search Functionality: Quickly search through your emails to find the information you need.

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

For ease, you can publish the assets by adding the following to your composer.json

"post-update-cmd": [
    "@php artisan vendor:publish --tag=mailweb-public --force"
]

Register the routes using the mailweb macro

Route::mailweb();

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, [
          'user@appoly.co.uk',
      ]);
  });
}

Should you want to allow access to all users then change the above code to

Gate::define("view-mailweb", function ($user) {
    return true;
});

Although it can be dangerous, should you want to allow access to anyone (regardless of authentication) then change the above code to

Gate::define("view-mailweb", function ($user = null) {
    return true;
});

In your local environment, it's advised to set your mail driver to LOG to prevent SMTP errors.

MAIL_MAILER=log

To view emails then go to

{url}\mailweb

Migrating to v5

If you previously used MailWeb you will notice a new archived table. This is because we have changed to data structure making it easier to pull out the email data we need rather than storing the whole email object. We are working on a command to migrate any stored emails over but for the time being these emails will no longer be viewable.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT