1. Go to this page and download the library: Download rudisang/laravel-mailbox 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/ */
rudisang / laravel-mailbox example snippets
declare(strict_types=1);
use App\Mail\InvoiceMail;
use App\Models\Invoice;
use Illuminate\Support\Facades\Mail;
use Rudisang\Mailbox\Testing\InteractsWithMailbox;
uses(InteractsWithMailbox::class);
it('captures the final invoice message', function (): void {
$invoice = Invoice::factory()->create();
Mail::to('[email protected]')->send(new InvoiceMail($invoice));
$this->mailbox()->latest()
->assertTo('[email protected]')
->assertSubject('Your invoice')
->assertHtmlContains('Invoice #123')
->assertHasAttachment('invoice-123.pdf', 'application/pdf')
->assertRawHeaderMissing('Bcc')
->assertEnvelopeContains('[email protected]')
->assertNoParseErrors();
});