FluentEmail icon indicating copy to clipboard operation
FluentEmail copied to clipboard

UsingTemplateFromFile should use configured FileProvider for relative paths

Open hisuwh opened this issue 2 years ago • 3 comments

We have just started out using FluentEmail. Our assumption was that this setup:

services
    .AddFluentEmail("[email protected]")
    .AddLiquidRenderer(options =>
    {
         options.FileProvider = new PhysicalFileProvider("C:\\email-templates");
    });

Combined with:

   .UsingTemplateFromFile("template.liquid", model)

Would result in the template C:\email-templates\template.liquid being used. Instead, it looks for a file called template.liquid in the current directory.

In reality we're reading that root path from config, it would be nice if this library worked as above so we do not need to use the config and absolute path everywhere we are trying to send an email.

hisuwh avatar Nov 19 '21 15:11 hisuwh

In fact this would be even more of a problem with a different file provider - i.e. if we wanted to store and read email templates from Azure Blob storage or similar as we would then have to load our template outside of FluentEmail and pass in raw at this point.

hisuwh avatar Nov 19 '21 15:11 hisuwh

I think I am running into this now, I have spent a ton of time trying to work out why my templates from file could never be found.

VictorioBerra avatar Feb 25 '22 17:02 VictorioBerra

+1 for this feature

Svudec avatar Apr 04 '22 14:04 Svudec