public string GetTemplatePath(EmailTemplate template)
        {
            var targetDirectory = _configuration.GetValue <string>("TemplateFolder");
            var directory       = targetDirectory;
            var filePath        = EmailConstants.GetTemplatePath(template);

            return(Path.Combine(directory, filePath));
        }
Пример #2
0
        public async Task <Email> BuildEmail(EmailRequestModel emailRequest)
        {
            _logger.LogInformation("Build email");

            var template = await GetTemplate(emailRequest.TemplateType);

            template = FormatTemplate(template, emailRequest);
            var emailModel = new Email
            {
                FromName   = emailRequest.SenderName,
                FromEmail  = "*****@*****.**",
                To         = emailRequest.Address,
                SenderName = emailRequest.SenderName,
                Subject    = EmailConstants.GetSubject(emailRequest.TemplateType),
                Content    = template,
                Attachment = emailRequest.Attachment
            };

            return(emailModel);
        }