PHP code example of empinet / laravel-outbound-mail-log

1. Go to this page and download the library: Download empinet/laravel-outbound-mail-log 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/ */

    

empinet / laravel-outbound-mail-log example snippets


return [
    'enabled' => env('OUTBOUND_MAIL_LOG_ENABLED', false),
    'cleanup_records_after' => env('OUTBOUND_MAIL_LOG_CLEANUP_RECORDS_AFTER', false),
    'log_headers' => env('OUTBOUND_MAIL_LOG_LOG_HEADERS', true),
    'log_body' => env('OUTBOUND_MAIL_LOG_LOG_BODY', true),
    'exclude_classes' => [],
];

'exclude_classes' => [
    App\Mail\PasswordResetMail::class,
    App\Notifications\SensitiveNotification::class,
],

use Illuminate\Support\Facades\Mail;

Mail::raw('Hello from the app', function ($message): void {
    $message->to('[email protected]')
        ->from('[email protected]')
        ->subject('Test message');
});

use Empinet\OutboundMailLog\Models\OutboundMailLog;

$latest = OutboundMailLog::query()
    ->latest('id')
    ->first();

use Illuminate\Support\Facades\Schedule;

Schedule::command('outbound-mail-log:cleanup')->daily();
bash
php artisan vendor:publish --tag="outbound-mail-log-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="outbound-mail-log-config"
bash
php artisan vendor:publish --tag="config"
dotenv
OUTBOUND_MAIL_LOG_ENABLED=true
dotenv
OUTBOUND_MAIL_LOG_ENABLED=true
OUTBOUND_MAIL_LOG_LOG_BODY=true
OUTBOUND_MAIL_LOG_LOG_HEADERS=true
OUTBOUND_MAIL_LOG_CLEANUP_RECORDS_AFTER=false
bash
php artisan outbound-mail-log:cleanup