예제 #1
0
        public Email GetCreateUserEmail(Web web, Domain domain, string email, string alias, Token confirmToken)
        {
            // Get to recipients
            EmailAddress toEmailAddress = new EmailAddress {
                Email = email, DisplayName = alias
            };
            IEnumerable <EmailAddress> toAddresses = Enumerable.Repeat(toEmailAddress, 1);
            IEnumerable <EmailAddress> configurationToAddresses = _emailConfigurationService.GetToEmailRecipients();

            if (configurationToAddresses != null)
            {
                toAddresses.Concat(configurationToAddresses);
            }

            // Get from (and reply to) email address
            string       host             = _webHelperService.GetHostFromUrl(domain.Url, true).ToLower();
            EmailAddress fromEmailAddress = new EmailAddress {
                Email = string.Format("donotreply@{0}", host), DisplayName = web.Name
            };

            // Get email content
            EmailContent content = GetCreateUserEmailContent(web.TenantId, email, alias, confirmToken);

            // Return resulting email
            return(new Email
            {
                Content = content,
                FromAddress = fromEmailAddress,
                ToAddresses = toAddresses,
                ReplyToAddress = fromEmailAddress,
                BccAddresses = _emailConfigurationService.GetBccEmailRecipients()
            });
        }
        public Email GetCreatePostEmail(string email, string alias, long postId, int?page, string subject, string postAlias)
        {
            // Get to recipients
            EmailAddress toEmailAddress = new EmailAddress {
                Email = email, DisplayName = alias
            };
            IEnumerable <EmailAddress> toAddresses = Enumerable.Repeat(toEmailAddress, 1);
            IEnumerable <EmailAddress> configurationToAddresses = _emailConfigurationService.GetToEmailRecipients();

            if (configurationToAddresses != null)
            {
                toAddresses.Concat(configurationToAddresses);
            }

            // Get email content
            EmailContent content = GetCreatePostEmailContent(email, alias, postId, page, subject, postAlias);

            // Return resulting email
            return(new Email
            {
                Content = content,
                FromAddress = _emailConfigurationService.GetFromEmailRecipient(),
                ToAddresses = toAddresses,
                ReplyToAddress = _emailConfigurationService.GetReplyToEmailRecipient(),
                BccAddresses = _emailConfigurationService.GetBccEmailRecipients()
            });
        }
예제 #3
0
        private Email GetEmail(Web web, Domain domain, Page page, FormSettings formSettings, IList <FormElementFieldValue> fieldValues)
        {
            // Get to recipients
            IEnumerable <EmailAddress> toAddresses = GetEmailAddresses(new string[] { "\r\n", "\n" }, formSettings.RecipientEmail);
            IEnumerable <EmailAddress> configurationToAddresses = _emailConfigurationService.GetToEmailRecipients();

            if (configurationToAddresses != null)
            {
                toAddresses.Concat(configurationToAddresses);
            }

            // Get from (and reply to) email address
            string       host             = _webHelperService.GetHostFromUrl(domain.Url, true).ToLower();
            EmailAddress fromEmailAddress = new EmailAddress {
                Email = string.Format("donotreply@{0}", host), DisplayName = web.Name
            };

            // Return email to send
            return(new Email
            {
                BccAddresses = _emailConfigurationService.GetBccEmailRecipients(),
                Content = GetEmailContent(page, fieldValues),
                FromAddress = fromEmailAddress,
                ReplyToAddress = fromEmailAddress,
                ToAddresses = toAddresses,
            });
        }