コード例 #1
0
        public static void SendSubscriptions(int TemplateId, int PortalId, int ModuleId, int TabId, Forum fi, int TopicId, int ReplyId, int AuthorId)
        {
            var                     _portalSettings = (Entities.Portals.PortalSettings)(HttpContext.Current.Items["PortalSettings"]);
            SettingsInfo            MainSettings    = DataCache.MainSettings(ModuleId);
            var                     sc   = new SubscriptionController();
            List <SubscriptionInfo> subs = sc.Subscription_GetSubscribers(PortalId, fi.ForumID, TopicId, SubscriptionTypes.Instant, AuthorId, fi.Security.Subscribe);

            if (subs.Count <= 0)
            {
                return;
            }

            string       Subject;
            string       BodyText;
            string       BodyHTML;
            string       sTemplate = string.Empty;
            var          tc        = new TemplateController();
            TemplateInfo ti;

            ti       = TemplateId > 0 ? tc.Template_Get(TemplateId) : tc.Template_Get("SubscribedEmail", PortalId, ModuleId);
            Subject  = TemplateUtils.ParseEmailTemplate(ti.Subject, string.Empty, PortalId, ModuleId, TabId, fi.ForumID, TopicId, ReplyId, string.Empty, AuthorId, _portalSettings.TimeZoneOffset);
            BodyText = TemplateUtils.ParseEmailTemplate(ti.TemplateText, string.Empty, PortalId, ModuleId, TabId, fi.ForumID, TopicId, ReplyId, string.Empty, AuthorId, _portalSettings.TimeZoneOffset);
            BodyHTML = TemplateUtils.ParseEmailTemplate(ti.TemplateHTML, string.Empty, PortalId, ModuleId, TabId, fi.ForumID, TopicId, ReplyId, string.Empty, AuthorId, _portalSettings.TimeZoneOffset);
            string sFrom;

            sFrom = fi.EmailAddress != string.Empty ? fi.EmailAddress : _portalSettings.Email;
            var oEmail = new Email
            {
                Recipients         = subs,
                Subject            = Subject,
                From               = sFrom,
                BodyText           = BodyText,
                BodyHTML           = BodyHTML,
                SmtpServer         = Host.SMTPServer,                     // Convert.ToString(_portalSettings.HostSettings["SMTPServer"]),
                SmtpUserName       = Host.SMTPUsername,                   // Convert.ToString(_portalSettings.HostSettings["SMTPUsername"]),
                SmtpPassword       = Host.SMTPPassword,                   // Convert.ToString(_portalSettings.HostSettings["SMTPPassword"]),
                SmtpAuthentication = Host.SMTPAuthentication,             // Convert.ToString(_portalSettings.HostSettings["SMTPAuthentication"]),
                SmtpSSL            = Host.EnableSMTPSSL.ToString(),       // Convert.ToString(_portalSettings.HostSettings["SMTPEnableSSL"]),
                UseQueue           = MainSettings.MailQueue
            };


            var objThread = new System.Threading.Thread(oEmail.Send);

            objThread.Start();
        }
コード例 #2
0
        public static void SendSubscriptions(int TemplateId, int PortalId, int ModuleId, int TabId, Forum fi, int TopicId, int ReplyId, int AuthorId)
        {
            var                     _portalSettings = (Entities.Portals.PortalSettings)(HttpContext.Current.Items["PortalSettings"]);
            SettingsInfo            MainSettings    = DataCache.MainSettings(ModuleId);
            var                     sc   = new SubscriptionController();
            List <SubscriptionInfo> subs = sc.Subscription_GetSubscribers(PortalId, fi.ForumID, TopicId, SubscriptionTypes.Instant, AuthorId, fi.Security.Subscribe);

            if (subs.Count <= 0)
            {
                return;
            }

            string       Subject;
            string       BodyText;
            string       BodyHTML;
            string       sTemplate = string.Empty;
            var          tc        = new TemplateController();
            TemplateInfo ti;

            ti = TemplateId > 0 ? tc.Template_Get(TemplateId) : tc.Template_Get("SubscribedEmail", PortalId, ModuleId);
            TemplateUtils.lstSubscriptionInfo = subs;
            Subject  = TemplateUtils.ParseEmailTemplate(ti.Subject, string.Empty, PortalId, ModuleId, TabId, fi.ForumID, TopicId, ReplyId, string.Empty, AuthorId, Convert.ToInt32(_portalSettings.TimeZone.BaseUtcOffset.TotalMinutes));
            BodyText = TemplateUtils.ParseEmailTemplate(ti.TemplateText, string.Empty, PortalId, ModuleId, TabId, fi.ForumID, TopicId, ReplyId, string.Empty, AuthorId, Convert.ToInt32(_portalSettings.TimeZone.BaseUtcOffset.TotalMinutes));
            BodyHTML = TemplateUtils.ParseEmailTemplate(ti.TemplateHTML, string.Empty, PortalId, ModuleId, TabId, fi.ForumID, TopicId, ReplyId, string.Empty, AuthorId, Convert.ToInt32(_portalSettings.TimeZone.BaseUtcOffset.TotalMinutes));
            string sFrom;

            sFrom = fi.EmailAddress != string.Empty ? fi.EmailAddress : _portalSettings.Email;
            var oEmail = new Email
            {
                Recipients = subs,
                Subject    = Subject,
                From       = sFrom,
                BodyText   = BodyText,
                BodyHTML   = BodyHTML,
                UseQueue   = MainSettings.MailQueue
            };


            var objThread = new System.Threading.Thread(oEmail.Send);

            objThread.Start();
        }
コード例 #3
0
        public static void SendSubscriptions(int TemplateId, int PortalId, int ModuleId, int TabId, Forum fi, int TopicId, int ReplyId, int AuthorId)
        {
            var _portalSettings = (Entities.Portals.PortalSettings)(HttpContext.Current.Items["PortalSettings"]);
            SettingsInfo MainSettings = DataCache.MainSettings(ModuleId);
            var sc = new SubscriptionController();
            List<SubscriptionInfo> subs = sc.Subscription_GetSubscribers(PortalId, fi.ForumID, TopicId, SubscriptionTypes.Instant, AuthorId, fi.Security.Subscribe);
            if (subs.Count <= 0)
            {
                return;
            }

            string Subject;
            string BodyText;
            string BodyHTML;
            string sTemplate = string.Empty;
            var tc = new TemplateController();
            TemplateInfo ti;
            ti = TemplateId > 0 ? tc.Template_Get(TemplateId) : tc.Template_Get("SubscribedEmail", PortalId, ModuleId);
            TemplateUtils.lstSubscriptionInfo = subs;
            Subject = TemplateUtils.ParseEmailTemplate(ti.Subject, string.Empty, PortalId, ModuleId, TabId, fi.ForumID, TopicId, ReplyId, string.Empty, AuthorId, _portalSettings.TimeZoneOffset);
            BodyText = TemplateUtils.ParseEmailTemplate(ti.TemplateText, string.Empty, PortalId, ModuleId, TabId, fi.ForumID, TopicId, ReplyId, string.Empty, AuthorId, _portalSettings.TimeZoneOffset);
            BodyHTML = TemplateUtils.ParseEmailTemplate(ti.TemplateHTML, string.Empty, PortalId, ModuleId, TabId, fi.ForumID, TopicId, ReplyId, string.Empty, AuthorId, _portalSettings.TimeZoneOffset);
            string sFrom;
            sFrom = fi.EmailAddress != string.Empty ? fi.EmailAddress : _portalSettings.Email;
            var oEmail = new Email
                             {
                                 Recipients = subs,
                                 Subject = Subject,
                                 From = sFrom,
                                 BodyText = BodyText,
                                 BodyHTML = BodyHTML,
                                 UseQueue = MainSettings.MailQueue
                             };

            var objThread = new System.Threading.Thread(oEmail.Send);
            objThread.Start();
        }