private void InitializeSubscribersForCampaign(IssueInfo issue, NewsletterInfo newsletter)
    {
        var recipients = issue.GetRecipientsProvider()
                         .GetMarketableRecipients()
                         .TopN(MAX_PREVIEW_SUBSCRIBERS)
                         .ToList();

        if (recipients.Count > 0)
        {
            for (int index = 0; index < recipients.Count; index++)
            {
                var recipient   = recipients[index];
                var subscriber  = recipient.ToContactSubscriber();
                var emailViewer = new EmailViewer(issue, newsletter, subscriber, true);

                emails.Add(HttpUtility.UrlEncode(recipient.ContactEmail));
                subjects.Add(GetEncodedSubscriberSubject(emailViewer));
                preheaders.Add(GetEncodedSubscriberPreheader(emailViewer));
                drpSubscribers.Items.Add(new ListItem(recipient.ContactEmail, index.ToString()));
            }
        }
        else
        {
            DisableSubscribersDropDownList();

            var emailViewer = new EmailViewer(issue, newsletter, null, true);

            InitializeZeroSubscribers(emailViewer.GetSubject(), emailViewer.GetPreheader());
        }
    }
    private void InitializeSubscribersForNewsletter(IssueInfo issue, NewsletterInfo newsletter)
    {
        var subscribers = SubscriberInfoProvider
                          .GetSubscribers()
                          .TopN(MAX_PREVIEW_SUBSCRIBERS)
                          .WhereIn("SubscriberID", new IDQuery(SubscriberNewsletterInfo.OBJECT_TYPE, "SubscriberID")
                                   .WhereEquals("NewsletterID", issue.IssueNewsletterID)
                                   .Where(w => w.WhereTrue("SubscriptionApproved")
                                          .Or()
                                          .WhereNull("SubscriptionApproved")));

        int subscriberIndex = 0;

        foreach (var subscriber in subscribers)
        {
            var member = SubscriberInfoProvider.GetSubscribers(subscriber, 1).FirstOrDefault();
            if (member == null)
            {
                continue;
            }

            var emailViewer = new EmailViewer(issue, newsletter, member, true);

            var identifier = GetSubscriberIdentifier(member, subscriber.SubscriberType);
            var subject    = GetEncodedSubscriberSubject(emailViewer);
            var preheader  = GetEncodedSubscriberPreheader(emailViewer);

            subjects.Add(subject);
            preheaders.Add(preheader);
            emails.Add(HttpUtility.UrlEncode(member.SubscriberEmail));

            drpSubscribers.Items.Add(new ListItem(identifier, subscriberIndex.ToString()));
            subscriberIndex++;
        }

        if (!SubscriberExists())
        {
            DisableSubscribersDropDownList();

            var emailViewer = new EmailViewer(issue, newsletter, null, true);

            InitializeZeroSubscribers(emailViewer.GetSubject(), emailViewer.GetPreheader());
        }
    }
    private string GetEncodedSubscriberPreheader(EmailViewer emailViewer)
    {
        var preheader = emailViewer.GetPreheader();

        return(HTMLHelper.HTMLEncode(preheader));
    }
    private string GetEncodedSubscriberSubject(EmailViewer emailViewer)
    {
        var subject = emailViewer.GetSubject();

        return(HTMLHelper.HTMLEncode(subject));
    }