Example #1
0
File: Emails.cs Project: pcstx/OA
        /// <summary>
        /// Based on the postID, this method will retrieve subscribers to the post and section.
        /// It will then create a unique list between them and call the method supplied vai the 
        /// EnquePostEmails delegate
        /// </summary>
        /// <param name="post">Post to send</param>
        /// <param name="epm">Method used to Enque the email</param>
        protected static void SectionTracking(Post post, EnquePostEmails epm, FormatList formats)
        {
            if (post == null)
                return;

            Hashtable threadSubscribers = GetEmailsTrackingThread(post.PostID);
            Hashtable sectionSubscribers = GetEmailsTrackingSectionByPostID(post.PostID);

            foreach(string email in threadSubscribers.Keys)
            {
                User sectionUser = sectionSubscribers[email] as User;
                if(sectionUser != null)
                    sectionSubscribers.Remove(email);
            }

            foreach(string email in sectionSubscribers.Keys)
            {
                threadSubscribers.Add(email,sectionSubscribers[email] as User);
            }

            sectionSubscribers.Clear();

            foreach (string email in threadSubscribers.Keys)
            {
                User subscriber = threadSubscribers[email] as User;
                // Make sure we don't send an email to the user that posted the message
                //
                if (subscriber.Email != post.User.Email)
                {
                    EnqueuEmail(epm(post,subscriber,formats));
                }
            }
        }
Example #2
0
File: Emails.cs Project: pcstx/OA
        public static void QueueContactRequest(string to, string from, string subject, string body, string appName, string link)
        {
            FormatList fl = new FormatList();
            fl.Add("AppTitle", appName);
            fl.Add("Body", body);
            fl.Add("link", link);
            fl.Add("useremail", from);
            fl.Add("Subject", subject);

            MailMessage email = GenericEmail("ContactForm",null,null,null,false,false);
            email.To = to;
            email.From = from;
            email.Body = fl.Format(email.Body);
            email.Subject = fl.Format(email.Subject);

            CommonDataProvider dp = CommonDataProvider.Instance();
            dp.EmailEnqueue(email);
        }