コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UserInfoBLL bll = new UserInfoBLL();

            if (!IsPostBack)
            {
                if (Session["user"] == null)
                {
                    Response.Redirect("Register.aspx");
                }
                string userName = "";
                userName = Session["user"].ToString();
                UserInfo      ui             = bll.GetUserInfoByUserName(userName);
                string        MessageFrom    = "*****@*****.**";
                string        MessageTo      = ui.Email;
                string        MessageSubject = "Activation from Bookshop";
                StringBuilder MessgeBody     = new StringBuilder();
                MessgeBody.Append("Hi," + ui.UserName);
                MessgeBody.Append("<br>Than you for signning up for BookShop");
                MessgeBody.Append("<br> please help us make sure we add you to the right website by verifying your email address");
                MessgeBody.Append("<br>http://localhost:61877/BookShop/ComfirmActivation.aspx?username="******"");
                MessgeBody.Append("<br>Have a great day");
                MessgeBody.Append("<br>Team Book Shop");
                Common.SendMail sm   = new Common.SendMail();
                bool            flag = sm.Send(MessageFrom, MessageTo, MessageSubject, MessgeBody.ToString());
                if (flag == true)
                {
                    Notice = ("Hello <b style='color:red;'>" + ui.UserName + "</b> Welcome to BookShopStall. Please activate your Account from your Email");
                }
            }
        }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         UserInfoBLL   bll            = new UserInfoBLL();
         string        id             = Request["id"];
         string        email          = Request["email"];
         UserInfo      ui             = bll.GetUserInfoByUserName(id);
         string        MessageFrom    = "*****@*****.**";
         string        MessageTo      = email;
         string        MessageSubject = "ChangePassword from Bookshop";
         StringBuilder MessgeBody     = new StringBuilder();
         MessgeBody.Append("Hi," + id);
         MessgeBody.Append("<br>BookShop receive a request to reset the password for your account");
         MessgeBody.Append("<br> To reset your password, click on the below");
         MessgeBody.Append("<br>http://localhost:61877/BookShop/ResetPassword.aspx?id=" + id + "&email=" + email);
         MessgeBody.Append("<br>Have a great day");
         MessgeBody.Append("<br>Team Book Shop");
         Common.SendMail sm   = new Common.SendMail();
         bool            flag = sm.Send(MessageFrom, MessageTo, MessageSubject, MessgeBody.ToString());
         if (flag == true)
         {
             Session["user"] = id;
             Notice          = ("Hello <b style='color:red;'>" + id + "</b> Welcome to BookShopStall. Please reset your password from your Email");
         }
     }
 }
コード例 #3
0
        public void Send(string to, string subject, string body)
        {
            System.Net.NetworkCredential credential;
            System.Security.SecureString secStr = new System.Security.SecureString();
            foreach (var c in GmailEncryptedPassword.Decrypt())
                secStr.AppendChar(c);
            credential = new System.Net.NetworkCredential(GmailUser, secStr);

            CSA.Common.SendMail sm = new Common.SendMail(GmailSmtpAddress, GmailSmtpPort, credential);
            sm.Send(to, subject, body);
        }