public override void Define(IEmailTemplateDefinitionContext context) { var template1 = new EmailTemplateDefinition("template1", defaultCultureName: "en", layout: null) .AddTemplateVirtualFiles("/Volo/Abp/Emailing/TestTemplates/Template1"); context.Add(template1); var template2 = new EmailTemplateDefinition("template2", layout: StandardEmailTemplates.DefaultLayout) .AddTemplateVirtualFiles("/Volo/Abp/Emailing/TestTemplates/Template2"); context.Add(template2); var template3 = new EmailTemplateDefinition("template3", layout: null, singleTemplateFile: true, localizationResource: typeof(AbpEmailingTestResource)) .AddTemplateVirtualFile("/Volo/Abp/Emailing/TestTemplates/Template3/Template.tpl"); context.Add(template3); }
protected virtual IFileInfo FindVirtualFileInfo(EmailTemplateProviderContributorContext contributorContext, EmailTemplateDefinition templateDefinition) { var virtualFilePath = templateDefinition?.GetVirtualFilePathOrNull(); if (virtualFilePath == null) { return(null); } var virtualFileProvider = contributorContext.ServiceProvider.GetRequiredService <IVirtualFileProvider>(); var fileInfo = virtualFileProvider.GetFileInfo(virtualFilePath); if (fileInfo?.Exists != true) { return(null); } return(fileInfo); }
public static EmailTemplateDefinition SetVirtualFilePath(this EmailTemplateDefinition emailTemplateDefinition, string path) { emailTemplateDefinition[VirtualFileEmailTemplateProviderContributor.VirtualFilePathKey] = path; return(emailTemplateDefinition); }
public static string GetVirtualFilePathOrNull(this EmailTemplateDefinition emailTemplateDefinition) { return(emailTemplateDefinition[VirtualFileEmailTemplateProviderContributor.VirtualFilePathKey] as string); }
public static EmailTemplateDefinition AddTemplateVirtualFile( this EmailTemplateDefinition emailTemplateDefinition, string path) { emailTemplateDefinition.Contributors.Add(new SingleVirtualFileEmailTemplateContributor(path)); return(emailTemplateDefinition); }