Yes, mocking the mail facade: https://laravel.com/docs/9.x/mocking#mail-fake.
Mail::fake()
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I never quite gotten used to requiring 2 classes (Mailable and User + record in user DB table) just to send an email
$user->notify(new \App\Notifications\Order\PaymentComplete($data));
So, what I normally do is write this instead
Mail::send('mail/autoreply', $sender,
function ($mail) use ($sender) {
$mail
->to($sender['email'], $sender['name'])
->subject('[Website Contact] '.$sender['subject']);
});
My question is, is there a Laravel way to test Mail::send(...)?
Please or to participate in this conversation.