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.
Leave a reply