1. Go to this page and download the library: Download ghijk/laravel-email-preview 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/ */
ghijk / laravel-email-preview example snippets
protected function schedule(Schedule $schedule)
{
$schedule->command('email-preview:cleanup')->daily();
}
use Ghijk\EmailPreview\Models\CapturedEmail;
// Query captured emails
$emails = CapturedEmail::query()
->search('[email protected]')
->mailableClass('App\\Mail\\WelcomeMail')
->dateRange('2024-01-01', '2024-12-31')
->get();
// Access email data
$email->to; // Array of recipients
$email->subject;
$email->html_body;
$email->text_body;
$email->attachments; // Array of attachment data
$email->mailable_class; // Original mailable class name