示例#1
0
        public async Task <IEnumerable <Email> > CreateEmailsAsync(EmailTemplate template)
        {
            Guard.Against.Null(template, nameof(template));
            Guard.Against.NullOrEmpty(template.Type, nameof(template.Type));
            Guard.Against.NullOrEmpty(template.Content.Subject, nameof(template.Content.Subject));
            Guard.Against.NullOrEmpty(template.Content.Text, nameof(template.Content.Text));

            var emailContext = await _emailContextProvider.GetEmailContextAsync();

            EmailFactory emailFactory = _emailFactoryProducer.GetEmailFactory(template.Type);

            return(emailFactory.CreateEmails(template.Content, emailContext));
        }