Posts Learn Components Snippets Categories Tags About

How to Preview Laravel Mail On Browser During Development

Learn how to preview your Laravel mail design during development from your browser using Laravel Mailable

Created on Aug 05, 2021


Designing a mail template is quite a challenge on normal web applications, but in the case of Laravel, you can make use Laravel Mailable template and preview the rendered mailable in the browser just like any of the typical Laravel Blade templates.

Return Mailable Instance
You can return a mailable instance from any of your controller files or directly from the route body like below.
Route::get('/welcome-user-mailable', function () {
    $user = App\Models\User::find(1);

    return new App\Mail\WelcomeUser($user);

By doing so you can focus on designing how the mail should look from the browser and when it's ready then send it to an actual email address.

Do note that inline attachments won't be rendered when previewing in the browser so you will have to use Mailhog or any of the related services.

Snippets by

PostSrc poster


Full stack developer mainly focusing on the front end side of the web. The main author of PostSrc and loves writing tutorial and guides online.


PostSrc Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that's right for your project.

View Components

Other Code Snippets