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

            return(Path.Combine(directory, filePath));
        }
Exemple #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  = emailRequest.SenderEmail,
                To         = emailRequest.DestinationAddress,
                SenderName = emailRequest.SenderName,
                Subject    = EmailConstants.GetSubject(emailRequest.TemplateType),
                Content    = template,
                Attachment = emailRequest.Attachment
            };

            return(emailModel);
        }