Пример #1
0
        /// <summary>
        /// 发送单封邮件 copy EBSSHOP
        /// </summary>
        /// <param name="email"></param>
        /// <param name="subject"></param>
        /// <param name="content"></param>
        /// <param name="revertmail"></param>
        public void SendOneMail(string email, string subject, string content, string revertmail)
        {
            string RevertMail = string.Empty;
            RevertMail = revertmail;

            DataAccess.PostMailInfo PM = new DataAccess.PostMailInfo();
            PM = db.PostMailInfo.FirstOrDefault();
            if (PM == null)
            {
                return;
            }

            SmtpClient MClient = new SmtpClient();
            MClient.DeliveryMethod = SmtpDeliveryMethod.Network;
            MClient.Host = PM.ServerName;
            MClient.Credentials = new System.Net.NetworkCredential(PM.UserName.ToString(), PM.MailPassword.ToString());

            MailMessage MailMsg = new MailMessage(PM.MailAddress, email);
            if (string.IsNullOrEmpty(RevertMail))
            {
                MailMsg.From = new MailAddress(PM.MailAddress.ToString());
            }
            else
            {
                MailMsg.From = new MailAddress(RevertMail.ToString());
            }

            MailMsg.BodyEncoding = System.Text.Encoding.UTF8;
            MailMsg.IsBodyHtml = true;
            MailMsg.Priority = MailPriority.High;
            MailMsg.Subject = subject.ToString();
            MailMsg.Body = content.ToString();
            try
            {
                MClient.Send(MailMsg);
            }
            catch (Exception e)
            {

            }
        }
Пример #2
0
 partial void UpdatePostMailInfo(PostMailInfo instance);
Пример #3
0
 partial void DeletePostMailInfo(PostMailInfo instance);
Пример #4
0
 partial void InsertPostMailInfo(PostMailInfo instance);