Closed erwindevreugd closed 6 years ago
Wouldn't using Razor for the email templates be a security issue?
I think the reason a basic html parser was used in the first place was so that (in the future) you could allow site editors / admins to edit the email templates without giving them access to Razor (this is a security risk).
Maybe it would be worth considering looking at how Orchard does things using Liquid (https://orchardcore.readthedocs.io/en/dev/OrchardCore.Modules/OrchardCore.Liquid/README/).
Based on Shopify templating engine: Safe, customer-facing template language for flexible web apps - https://shopify.github.io/liquid/
If you use something like liquid then it can also be used for other type of templates such as site / layout templates :)
EDIT: Checkout this nuget package as it is the standalone version of liquid - https://github.com/sebastienros/fluid
You can checkout also scriban at https://github.com/lunet-io/scriban
@JustCallMeAD could you ellaborate on the security concern a bit?
Looks like you might want to look at Microsoft.AspNetCore.Razor.Language.dll and the RazorTemplateEngine class.