You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert

28
+

29
29
30
30
This package logs all outgoing emails to a database and provides a web interface to view them, formatted as they appear in modern email clients like Gmail.
31
31
32
32
---
33
33
34
-
## Installation
34
+
<!-- TOC -->
35
+
*[Laravel Mail Viewer](#laravel-mail-viewer)
36
+
*[Features](#features)
37
+
*[Installation](#installation)
38
+
*[Step 1: Install via Composer](#step-1-install-via-composer)
*[Register package for non-production environments](#register-package-for-non-production-environments)
49
+
*[License](#license)
50
+
*[Credits](#credits)
51
+
<!-- TOC -->
52
+
53
+
## Features
54
+
- Logs all outgoing emails to the database
55
+
- Modern in-browser email viewer
56
+
- Searchable UI with auto-refreshing entries
57
+
- Configurable route and access protection
58
+
- Optional email pruning
35
59
60
+
## Installation
36
61
### Step 1: Install via Composer
37
62
38
63
Run the following command in your terminal:
@@ -80,15 +105,19 @@ The package supports Laravel's [Model Pruning](https://laravel.com/docs/eloquent
80
105
By default, the email viewer is publicly accessible.
81
106
In a production environment, it's highly recommended to restrict access
82
107
using middleware or something like [Access Screen](https://github.com/MasterRO94/laravel-access-screen) package.
108
+
Alternatively, you can disable the package in production environments.
83
109
84
110
### Restrict Access with Middleware
85
111
86
-
Modify your `routes/web.php` to apply authentication:
112
+
Modify your `config/mail-viewer.php` to apply authorization:
87
113
88
114
```php
89
115
'middleware' => ['web', 'can:viewMailLogs'],
90
116
```
91
117
118
+
> **Note:**`viewMailLogs` is just an example ability you can register via Laravel’s [Authorization Gate](https://laravel.com/docs/authorization#writing-gates).
119
+
> This ability is not included in the package.
120
+
92
121
You can also limit access by IP address in `App\Http\Middleware\RestrictMailViewerAccess.php`:
93
122
94
123
```php
@@ -113,14 +142,38 @@ class RestrictMailViewerAccess
0 commit comments