示例#1
0
        public string GetTemplateHtml(string templateName)
        {
            var html = File.ReadAllText($"{_emailTemplateConfiguration.TemplatesFolderPath}/{templateName}.html");

            var minificationResult = _markupMinifier.Minify(html);

            if (minificationResult.Errors.Any())
            {
                var errors = minificationResult.Errors.Select(error => error.Message).ToList();

                _logger.Event("Softeq.NetKit.EmailTemplateProvider")
                .With.Message($"Couldn't minify content for '{templateName}' template. Errors: {string.Join(";", errors)}")
                .AsError();

                return(html);
            }

            return(minificationResult.MinifiedContent);
        }