FluentEmail icon indicating copy to clipboard operation
FluentEmail copied to clipboard

Layout is not used in the mail sent. (.Net Core 3.1)

Open huseyingoztok opened this issue 5 years ago • 1 comments

I have two problems.

  1. How do I pass a folder under the Views folder as the default path (to send mail with the template.)
  2. My layout file is not used in the sent mail.

huseyingoztok avatar Jun 10 '20 15:06 huseyingoztok

@huseyingoztok

This is what I did - this is a Layout.cshtml file set up as an embedded resouce:

@using RazorLight
<!DOCTYPE html>
<html lang="">
    <head>
        <title></title>
    </head>
    <body>
        <div>@RenderBody()</div>
    </body>
</html>

Then for your Email Template - again as an embedded resource:

@using RazorLight
@inherits TemplatePage<model>

@{
    Layout = "<namespace>.Layout.cshtml";
}

Hi model.name! 

Obviously is uses the embedded resource namespace to get to the template.

Simonl9l avatar Oct 27 '20 23:10 Simonl9l