コード例 #1
0
        /// <summary>
        /// Method to send email to the list of users
        /// </summary>
        /// <param name="TribuetId">Tribute ID to get the list of admin</param>
        /// <param name="strSubject">Subject of the mail</param>
        public void SendEmail(int TribuetId, string strSubject, string EmailBody)
        {
            StoryResource objStoryRes = new StoryResource();

            UserInfo objUser = objStoryRes.GetTributeAdministrators(TribuetId, "Gift");
            //Function to send the mail to the list of users who have added the Tribute in their list of favourites
            UserInfo objUserFav = objStoryRes.GetFavouriteTributeUsers(TribuetId, "Gift");

            EmailMessages objEmail = EmailMessages.Instance;

            if (objUser.UserEmail != "")
            {
                bool val = objEmail.SendMessages("Your " + WebConfig.ApplicationWord + "<" + WebConfig.NoreplyEmail + ">", objUser.UserEmail, strSubject, CreateBody(EmailBody), EmailMessages.TextFormat.Html.ToString());
            }

            //favourite mail
            //As per discussion with Rupendra: will send the mail in "To" field.
            //ie a comma separated list of users in the "to" field
            if (objUserFav.UserEmail != "")
            {
                bool val = objEmail.SendMessages("Your " + WebConfig.ApplicationWord + "<" + WebConfig.NoreplyEmail + ">", objUserFav.UserEmail, strSubject, CreateBody(EmailBody), EmailMessages.TextFormat.Html.ToString());
            }
        }