Пример #1
0
        Email buildEmail(IEmailAudience audience, Action <EmailBuilder> email)
        {
            var builder = new EmailBuilder(_emailClient, _templateService);

            builder.To(audience.To);

            if (audience.From != null)
            {
                builder.From(audience.From.EmailAddress, audience.From.DisplayName);
            }

            if (audience.Cc != null)
            {
                builder.Cc(audience.Cc);
            }

            if (audience.Bcc != null)
            {
                builder.Bcc(audience.Bcc);
            }

            email(builder);

            var builtEmail = builder.Build();

            ensureToAndFromHaveNotBeenModifed(builtEmail, audience);
            //ensureCcAndBccHaveNotBeenModifed(builtEmail, audience);

            return(builtEmail);
        }
Пример #2
0
        public Email Create(Action <EmailBuilder> email)
        {
            var builder = new EmailBuilder(_emailClient, _templateService);

            email(builder);
            return(builder.Build());
        }