Laravel Mail Markdown Components

Sam Ngu
May 19, 2020

--

A quick visual reference on the latest Laravel mail markdown components.

Note: I’m using Laravel 7 at the time of writing this article.

Source code:

Quick Start

Create a Laravel Mail class:

php artisan make:mail TestMail --markdown

In the build method, reference your mail.blade.php file.

public function build(){  return $this->markdown('mail.blade.file.in.views.folder');}

To customise the markdown templates, run:

php artisan vendor:publish --tag=laravel-mail

You will find the source files in `resources/views/vendor/mail` and make any changes as you wish 😉.

How to test my Laravel Email template without actually sending it out?

Create a new Route and see it in your browser!

Route::get('/view-mail', function(){  $mail = new App\Mail\TestMail();  return $mail->render();});

--

--

No responses yet