FluentEmail
FluentEmail copied to clipboard
Layout is not used in the mail sent. (.Net Core 3.1)
I have two problems.
- How do I pass a folder under the Views folder as the default path (to send mail with the template.)
- My layout file is not used in the sent mail.
@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.