Exemple #1
0
        private void SendEMail(string email)
        {
            string str;
            IList <MailAddress> list     = new List <MailAddress>();
            MailState           none     = MailState.None;
            MailInfo            mailInfo = new MailInfo();

            mailInfo.MailBody   = base.MessageBody;
            mailInfo.Subject    = base.MessageTitle;
            mailInfo.IsBodyHtml = true;
            if (this.m_SendType == SendType.SendToContacter)
            {
                str = "收货人";
            }
            else
            {
                str = "会员";
            }
            if (!string.IsNullOrEmpty(email) && DataValidator.IsEmail(email))
            {
                list.Add(new MailAddress(email));
                mailInfo.MailToAddressList = list;
                none = SendMail.Send(mailInfo);
                if (none == MailState.Ok)
                {
                    base.SuccessMsg.Append("<br>已经向" + str + "发送了一封Email,通知他");
                    base.SuccessMsg.Append(base.OperationMsg);
                    base.SuccessMsg.Append("!");
                }
                else
                {
                    string mailStateInfo = SendMail.GetMailStateInfo(none);
                    base.ErrorMsg.Append("<br>");
                    base.ErrorMsg.Append(mailStateInfo);
                    base.ErrorMsg.Append(",向" + str + "发送邮件失败!");
                }
            }
            else
            {
                base.ErrorMsg.Append("<br>邮件地址为空或无效邮件地址,向" + str + "发送邮件失败!");
            }
        }