Esempio n. 1
0
        /// <summary>
        /// Create a list so that each mail can be sent individually
        /// </summary>
        /// <returns>Mailing list</returns>
        private List <MailMessage> GetMailMessageList()
        {
            //MailMessage msg = new MailMessage();
            //msg.From = From.GetMailAddress();

            //foreach (EmailAddress eml in To)
            //{
            //    msg.To.Add(eml.GetMailAddress());
            //}

            //if (Cc != null)
            //{
            //    foreach (EmailAddress eml in Cc)
            //    {
            //        msg.CC.Add(eml.GetMailAddress());
            //    }
            //}

            //if (Bcc != null)
            //{
            //    foreach (EmailAddress eml in Bcc)
            //    {
            //        msg.Bcc.Add(eml.GetMailAddress());
            //    }
            //}

            List <MailMessage> msgList = new List <MailMessage>();

            foreach (EmailAddress eml in To)
            {
                MailMessage msg = new MailMessage();
                msg.From = From.GetMailAddress();
                msg.To.Add(eml.GetMailAddress());
                msg.Subject         = EmailSubject;
                msg.SubjectEncoding = Encoding.UTF8;

                msg.Body         = Body;
                msg.BodyEncoding = Encoding.UTF8;
                msgList.Add(msg);
            }

            //if (Cc != null)
            //{
            //    foreach (EmailAddress eml in Cc)
            //    {
            //        msg.CC.Add(eml.GetMailAddress());
            //    }
            //}

            //if (Bcc != null)
            //{
            //    foreach (EmailAddress eml in Bcc)
            //    {
            //        msg.Bcc.Add(eml.GetMailAddress());
            //    }
            //}



            //msg.Subject = EmailSubject;
            //msg.SubjectEncoding = Encoding.UTF8;

            //msg.Body = Body;
            //msg.BodyEncoding = Encoding.UTF8;
            //msg.IsBodyHtml = IsBodyHTML;

            return(msgList);
        }