zoukankan      html  css  js  c++  java
  • Send Mail

    //Send mail
                string code = user.ProviderUserKey.ToString();
                System.Net.Mail.SmtpClient sc = new SmtpClient();
                sc.Host = ConfigurationManager.AppSettings["MySmtp"].ToString();

                string  mf = ConfigurationManager.AppSettings["MailFrom"].ToString();
                string  mt = ConfigurationManager.AppSettings["MailTo"].ToString();
                          
                MailMessage mm = new MailMessage(mf,mt);

                MailAddress mr = new MailAddress(ConfigurationManager.AppSettings["MailReplyTo"].ToString());

                mm.IsBodyHtml = Convert.ToBoolean(Convert.ToInt16(ConfigurationManager.AppSettings["MailIsBodyHTML"].ToString()));
                mm.ReplyTo = mr;

                mm.Subject = ConfigurationManager.AppSettings["MailSubject"].ToString();
                //Body
                string strList = "";
                string[] array = System.IO.File.ReadAllLines(Server.MapPath(".") + "/" + ConfigurationManager.AppSettings["BodyByFile"].ToString());
                for (int i = 0; i < array.Length - 1; i++)
                {
                    strList += array[i].ToString();
                }
                strList = strList.Replace("<% UserName %>", user.UserName.ToString()).Replace("<% Email %>", user.Email.ToString()).Replace("<% FirstName %>", pc.FirstName.ToString()).Replace("<% LastName %>", pc.LastName.ToString()).Replace("<% Company %>", pc.Company.ToString());
                strList = strList.Replace("<% Address %>", pc.Address.ToString()).Replace("<% WebSite %>", pc.WebSite.ToString()).Replace("<% Country %>", pc.Country.ToString()).Replace("<% City %>", pc.City.ToString()).Replace("<% State %>", pc.State.ToString());
                strList = strList.Replace("<% Phone %>", pc.Phone.ToString()).Replace("<% Mobile %>", pc.Mobile.ToString()).Replace("<% ConfirmationCode %>", user.ProviderUserKey.ToString()).ToString();
                mm.Body = strList;

                sc.Send(mm);
                sc = null;

  • 相关阅读:
    GDB编辑、搜索源码以及在线帮助
    GDB查看栈信息
    GDB信号处理
    GDB反向调试
    GDB调试多进程程序
    GDB后台调试命令
    GDB non-stop模式
    GDB调试多线程程序
    GDB禁用删除断点
    解决Mac OS下Eclipse、IntelliJ IDEA打开其他窗口默认全屏
  • 原文地址:https://www.cnblogs.com/jacker1979/p/1058584.html
Copyright © 2011-2022 走看看