PHP code example of masterro / laravel-mail-viewer

1. Go to this page and download the library: Download masterro/laravel-mail-viewer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

masterro / laravel-mail-viewer example snippets


'prune_older_than_days' => 365,

'middleware' => ['web', 'can:viewMailLogs'],

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class RestrictMailViewerAccess
{
    public function handle(Request $request, Closure $next)
    {
        if (!in_array($request->ip(), ['127.0.0.1', '::1', 'YOUR_ALLOWED_IP'])) {
            abort(403);
        }

        return $next($request);
    }
}

'middleware' => ['web', RestrictMailViewerAccess::class],

use MasterRO\MailViewer\Providers\MailViewerServiceProvider;

public function register(): void
{
    if (!$this->app->environment('production')) {
        $this->app->register(MailViewerServiceProvider::class);
    }
}
sh
php artisan mail-viewer:publish
sh
php artisan migrate