/// <summary>
    /// Creates and sends unsubscription e-mail.
    /// </summary>
    /// <param name="subscriber">Subscriber object</param>
    /// <param name="news">Newsletter object</param>
    /// <param name="subscription">Subscription object</param>
    /// <param name="siteName">Site name</param>
    protected void SendUnsubscriptionRequest(SubscriberInfo subscriber, NewsletterInfo news, SubscriberNewsletterInfo subscription, string siteName)
    {
        // Get global e-mail template with unsubscription request
        EmailTemplateInfo et = EmailTemplateProvider.GetEmailTemplate("newsletter.unsubscriptionrequest", siteName);

        if (et != null)
        {
            // Get subscriber member
            SortedDictionary <int, SubscriberInfo> subscribers = SubscriberInfoProvider.GetSubscribers(subscriber, 1, 0);
            foreach (KeyValuePair <int, SubscriberInfo> item in subscribers)
            {
                // Get 1st subscriber's member
                SubscriberInfo sb = item.Value;

                string body      = et.TemplateText;
                string plainBody = et.TemplatePlainText;

                // Resolve newsletter macros (first name, last name etc.)
                IssueHelper ih = new IssueHelper();
                if (ih.LoadDynamicFields(sb, news, subscription, null, false, siteName, null, null, null))
                {
                    body      = ih.ResolveDynamicFieldMacros(body);
                    plainBody = ih.ResolveDynamicFieldMacros(plainBody);
                }

                // Create e-mail
                EmailMessage msg = new EmailMessage();
                msg.EmailFormat   = EmailFormatEnum.Default;
                msg.From          = EmailHelper.GetSender(et, news.NewsletterSenderEmail);
                msg.Recipients    = sb.SubscriberEmail;
                msg.BccRecipients = et.TemplateBcc;
                msg.CcRecipients  = et.TemplateCc;
                msg.Subject       = ResHelper.LocalizeString(et.TemplateSubject);
                msg.Body          = URLHelper.MakeLinksAbsolute(body);
                msg.PlainTextBody = URLHelper.MakeLinksAbsolute(plainBody);

                // Add attachments and send e-mail
                MetaFileInfoProvider.ResolveMetaFileImages(msg, et.TemplateID, EmailObjectType.EMAILTEMPLATE, MetaFileInfoProvider.OBJECT_CATEGORY_TEMPLATE);

                EmailSender.SendEmail(siteName, msg);
            }
        }
        else
        {
            // Log missing template
            EventLogProvider ev = new EventLogProvider();
            ev.LogEvent(EventLogProvider.EVENT_TYPE_ERROR, DateTime.Now, "UnsubscriptionRequest", "Unsubscription request e-mail template is missing.");
        }
    }
    /// <summary>
    /// Creates and sends unsubscription e-mail.
    /// </summary>
    /// <param name="subscriber">Subscriber to be unsubscribed</param>
    /// <param name="news">Newsletter object</param>
    /// <param name="siteName">Name of site that subscriber is being unsubscribed from</param>
    protected void SendUnsubscriptionRequest(SubscriberInfo subscriber, NewsletterInfo news, string siteName)
    {
        var emailTemplate = EmailTemplateProvider.GetEmailTemplate("newsletter.unsubscriptionrequest", siteName);

        if (emailTemplate == null)
        {
            EventLogProvider.LogEvent(EventType.ERROR, "UnsubscriptionRequest", "Unsubscription request e-mail template is missing.");
            return;
        }

        string body      = emailTemplate.TemplateText;
        string plainBody = emailTemplate.TemplatePlainText;

        // Resolve newsletter macros (first name, last name etc.)
        var issueHelper = new IssueHelper();

        if (issueHelper.LoadDynamicFields(subscriber, news, null, null, false, siteName, null, null, null))
        {
            body      = issueHelper.ResolveDynamicFieldMacros(body, news);
            plainBody = issueHelper.ResolveDynamicFieldMacros(plainBody, news);
        }

        // Create e-mail
        var subscriberEmailRetriever = Service <ISubscriberEmailRetriever> .Entry();

        var emailMessage = new EmailMessage
        {
            EmailFormat   = EmailFormatEnum.Default,
            From          = EmailHelper.GetSender(emailTemplate, news.NewsletterSenderEmail),
            Recipients    = subscriberEmailRetriever.GetSubscriberEmail(subscriber.SubscriberID),
            BccRecipients = emailTemplate.TemplateBcc,
            CcRecipients  = emailTemplate.TemplateCc,
            Subject       = ResHelper.LocalizeString(emailTemplate.TemplateSubject),
            Body          = URLHelper.MakeLinksAbsolute(body),
            PlainTextBody = URLHelper.MakeLinksAbsolute(plainBody)
        };

        // Add attachments and send e-mail
        EmailHelper.ResolveMetaFileImages(emailMessage, emailTemplate.TemplateID, EmailTemplateInfo.OBJECT_TYPE, ObjectAttachmentsCategories.TEMPLATE);
        EmailSender.SendEmail(siteName, emailMessage);
    }