示例#1
0
        private void SendMail(int requestSysNo)
        {
            //获取收件人
            List <string> EmailsTo = VirtualRequestCommonDA.GetUserMailByVirtualRequest(requestSysNo, CompanyCode);

            if (EmailsTo.Count == 0)
            {
                WriteLog("没有邮件接收人!");
                return;
            }
            else
            {
                foreach (string mailAddress in EmailsTo)
                {
                    MailTo += ";" + mailAddress;
                }
                MailTo = MailTo.Remove(0, 1);
            }

            //获取虚库申请单中的商品信息作为邮件Body
            ProductVirtualInfoEntity productInfo = VirtualRequestCommonDA.GetProductInfoByVirtualRequestSysNo(requestSysNo, CompanyCode);

            Subject = "虚库申请单结束失败 " + productInfo.ProductID + productInfo.ProductName;
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(string.Format("商品名称:{0}", productInfo.ProductName));
            sb.AppendLine(string.Format("商品SysNo:{0}", productInfo.ProductSysNo));
            sb.AppendLine(string.Format("商品ID:{0}", productInfo.ProductID));
            sb.AppendLine(string.Format("商品链接:http:{0}", productInfo.ProductLink));
            sb.AppendLine(string.Format("商品链接:http:{0}", productInfo.ProductLink));
            sb.AppendLine(string.Format("设定虚库数量:{0}", productInfo.VirtualQty));
            sb.AppendLine(string.Format("生效虚库数量:{0}", productInfo.HoldVirtualQty));
            sb.AppendLine(string.Format("开始时间:{0}", productInfo.StartTime));
            sb.AppendLine(string.Format("结束时间:{0}", productInfo.EndTime));
            sb.AppendLine(string.Format("状态:{0}", productInfo.StatusDescription));

            MailBody = sb.ToString();

            //Email_InternalInfoEntity mail = new Email_InternalInfoEntity();

            MailInfo mail = new MailInfo();

            mail.FromName = MailFrom;
            mail.ToName   = MailTo;
            mail.CCName   = CCMailAddress;
            mail.BCCName  = BCMailAddress;
            mail.Subject  = Subject;
            mail.Body     = MailBody;

            MailAdapter.Send(mail);
        }
示例#2
0
        private void SendMail(int requestSysNo)
        {
            //获取收件人
            List <string> EmailsTo = VirtualRequestCommonDA.GetUserMailByVirtualRequest(requestSysNo, CompanyCode);

            if (EmailsTo.Count == 0)
            {
                WriteLog("没有邮件接收人!");
                return;
            }
            else
            {
                MailTo = "";
                foreach (string mailAddress in EmailsTo)
                {
                    MailTo += ";" + mailAddress;
                }
                MailTo = MailTo.Remove(0, 1);
            }

            //获取虚库申请单中的商品信息作为邮件Body
            ProductVirtualInfoEntity productInfo = VirtualRequestCommonDA.GetProductInfoByVirtualRequestSysNo(requestSysNo, CompanyCode);

            Subject = string.Format("<p style='font-size:10.5pt;color:red'>虚库申请单结束失败 {0} {1}</p>", productInfo.ProductID, productInfo.ProductName);
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(string.Format("<p style='font-size:10.5pt;font-family:宋体;color:blue'>商品名称:{0}</p>", productInfo.ProductName));
            sb.AppendLine(string.Format("<p style='font-size:10.5pt;font-family:宋体;color:blue'>商品SysNo:{0}</p>", productInfo.ProductSysNo));
            sb.AppendLine(string.Format("<p style='font-size:10.5pt;font-family:宋体;color:blue'>商品ID:{0}</p>", productInfo.ProductID));
            sb.AppendLine(string.Format("<p style='font-size:10.5pt;font-family:宋体;color:blue'>商品链接:<a href='http://www.newegg.com.cn/Products/ProductDetail.aspx?sysno={0}'>http://www.newegg.com.cn/Products/ProductDetail.aspx?sysno={0}<a/></p>", productInfo.ProductSysNo));
            sb.AppendLine(string.Format("<p style='font-size:10.5pt;font-family:宋体;color:blue'>设定虚库数量:{0}</p>", productInfo.VirtualQty));
            sb.AppendLine(string.Format("<p style='font-size:10.5pt;font-family:宋体;color:blue'>生效虚库数量:{0}</p>", productInfo.HoldVirtualQty));
            sb.AppendLine(string.Format("<p style='font-size:10.5pt;font-family:宋体;color:blue'>开始时间:{0}</p>", productInfo.StartTime));
            sb.AppendLine(string.Format("<p style='font-size:10.5pt;font-family:宋体;color:blue'>结束时间:{0}</p>", productInfo.EndTime));
            sb.AppendLine(string.Format("<p style='font-size:10.5pt;font-family:宋体;color:blue'>状态:{0}</p>", productInfo.StatusDescription));

            MailBody = sb.ToString();

            //Email_InternalInfoEntity mail = new Email_InternalInfoEntity();
            MailInfo mail = new MailInfo();

            mail.FromName = MailFrom;
            mail.ToName   = MailTo;
            mail.CCName   = CCMailAddress;
            mail.BCCName  = BCMailAddress;
            mail.Subject  = Subject;
            mail.Body     = MailBody;

            MailAdapter.Send(mail);
        }
        public void Send(ContactUs data)
        {
            ValidateInput(data);

            StringBuilder body = new StringBuilder();

            body.AppendFormat("<div>Name: {0}</div>", data.Name);
            body.AppendFormat("<div>Address: {0}</div>", data.Address);
            body.AppendFormat("<div>Town: {0}</div>", data.Town);
            body.AppendFormat("<div>Phone: {0}</div>", data.Phone);
            body.AppendFormat("<div>Email: {0}</div>", data.Email);
            body.AppendFormat("<div>Comments:</div><p>{0}</p>", data.Comments);

            SiteMessage siteMessage = new SiteMessage()
            {
                From    = data.Email,
                To      = ConfigurationManager.AppSettings["ContactUsEmailAddress"],
                Subject = ConfigurationManager.AppSettings["ContactUsEmailSubject"],
                Body    = body.ToString()
            };

            mailAdapter.Send(siteMessage);
        }