Exemple #1
0
        public void SendMail(ECCentral.Service.Utility.MailMessage mailMessage, bool isAsync, bool isInternal)
        {
            if (isAsync)
            {
                //发送异步邮件
                if (isInternal)
                {
                    ObjectFactory <EmailProcessor> .Instance.SendAsyncMailInternal(mailMessage);
                }
                else
                {
                    ObjectFactory <EmailProcessor> .Instance.SendAsyncMail(mailMessage);
                }
            }
            else
            {
                //发送同步邮件
                TCPMail tcpMail = new TCPMail();
                tcpMail.Priority = (System.Net.Mail.MailPriority)Enum.Parse(typeof(System.Net.Mail.MailPriority), mailMessage.Priority.ToString());
                tcpMail.Html     = mailMessage.IsHtmlType;

                bool isSucc = tcpMail.Send(mailMessage.ToName, mailMessage.CCName, mailMessage.BCCName, mailMessage.Subject, mailMessage.Body, mailMessage.Attachments, mailMessage.FromName, mailMessage.DisplaySenderName);
                if (!isSucc)
                {
                    throw new ApplicationException("发送邮件失败!");
                }
            }
        }
 public void SendMail(ECCentral.Service.Utility.MailMessage mailMessage)
 {
     ObjectFactory <IEmailSend> .Instance.SendMail(mailMessage, true, false);
 }