Beispiel #1
0
        private void StartNewsLetter(NewletterSettings newletterSettings, bool testEmail = false)
        {
            var embySettings = EmbySettings.GetSettings();

            if (embySettings.Enable)
            {
                var html = EmbyNewsletter.GetNewsletterHtml(testEmail);

                var escapedHtml = new string(html.Where(c => !char.IsControl(c)).ToArray());
                Log.Debug(escapedHtml);
                SendNewsletter(newletterSettings, escapedHtml, testEmail, "New Content On Emby!");
            }
            else
            {
                var plexSettings = PlexSettings.GetSettings();
                if (plexSettings.Enable)
                {
                    var html = PlexNewsletter.GetNewsletterHtml(testEmail);

                    var escapedHtml = new string(html.Where(c => !char.IsControl(c)).ToArray());
                    Log.Debug(escapedHtml);
                    SendNewsletter(newletterSettings, html, testEmail);
                }
            }
        }
        private void StartNewsLetter(NewletterSettings newletterSettings, bool testEmail = false)
        {
            var embySettings = EmbySettings.GetSettings();

            if (embySettings.Enable)
            {
                var letter = EmbyNewsletter.GetNewsletter(testEmail) ?? new Newsletter();
                if (letter.Send || testEmail)
                {
                    SendNewsletter(newletterSettings, letter.Html, testEmail, "New Content On Emby!");
                }
                else
                {
                    Log.Warn("There is no new content to send the newsletter");
                }
            }
            else
            {
                var plexSettings = PlexSettings.GetSettings();
                if (plexSettings.Enable)
                {
                    var letter = PlexNewsletter.GetNewsletter(testEmail) ?? new Newsletter();
                    if (letter.Send || testEmail)
                    {
                        SendNewsletter(newletterSettings, letter.Html, testEmail);
                    }
                }
            }
        }