PHP code example of rnsharma93 / laravel-email-sandbox

1. Go to this page and download the library: Download rnsharma93/laravel-email-sandbox 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/ */

    

rnsharma93 / laravel-email-sandbox example snippets


Mail::mailer('email-sandbox')->to($user)->send(new OrderShipped($order));

use Illuminate\Support\Facades\Gate;

public function boot(): void
{
    Gate::define('accessEmailSandbox', function ($user) {
        // Return true if the user is an admin or authorized to view intercepted emails
        return in_array($user->email, [
            '[email protected]',
        ]);
    });
}

// config/email-sandbox.php
return [
    // The URL prefix where the dashboard is served, e.g. /email-sandbox
    'route_prefix' => 'email-sandbox',

    // Where raw .eml snapshots and attachments are stored on disk
    'storage_path' => storage_path('app/email-sandbox'),
];
bash
php artisan vendor:publish --tag="email-sandbox-config"
bash
php artisan migrate