Coravel's mailer comes with some pre-built e-mail friendly razor templates! This means you don't have to worry about
building a reusable template and store it in your database. But.... no one ever does that 😋.

TIP

If you used the Coravel CLI, it already created the file ~/Views/Mail/_ViewStart.cshtml. It defaults to use Coravel's "colorful" template.

If you wish to use the plain template, replace the file contents with this:

Using a razor view to send e-mails is done using the View(string viewPath, T viewModel) method.

The type of the viewModel parameter must match the type of your Mailable's generic type parameter. For example, a Mailable<UserModel> will have the method View(string viewPath, UserModel viewModel). Coravel will automatically bind the model to your view so you can generate dynamic content (just like using View() inside your MVC controllers).

For views that do not require a view model, just inherit your Mailable from Mailable<string> and use View(string viewPath).