Example #1
0
        public string GetCustEmailFromEmailingCode(string emailingCode)
        {
            var aesMgr = new AESManager();
            var code   = aesMgr.DecryptString(emailingCode);

            return(aesMgr.EncryptToString(code.Split('|').First()));
        }
Example #2
0
        public void SendResetPasswordEmail(string activationCode, string username, string url)
        {
            var sptEmail    = new AESManager().DecryptString(ConfigurationManager.AppSettings.Get("SptEmail"));
            var sptPassword = new AESManager().DecryptString(ConfigurationManager.AppSettings.Get("SptPassword"));
            var email       = new AESManager().DecryptString(GetCustEmailFromEmailingCode(activationCode));

            using (MailMessage mm = new MailMessage(sptEmail, email))
            {
                mm.Subject = "Reset Password";
                string body = "Hey " + username + "!";
                body         += "<br /><br />Please click the following link to reset your password";
                body         += "<br /><a href = '" + url + "ResetPassword.aspx?RE=" + activationCode + "'>Reset password.</a>";
                body         += "<br /><br />Thanks";
                mm.Body       = body;
                mm.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient();
                smtp.Host      = "smtp.gmail.com";
                smtp.EnableSsl = true;
                NetworkCredential NetworkCred = new NetworkCredential(sptEmail, sptPassword);
                smtp.UseDefaultCredentials = true;
                smtp.Credentials           = NetworkCred;
                smtp.Port = 587;
                smtp.Send(mm);
            }
        }
Example #3
0
        public string GetEmailingCode(string custEncrEmail)
        {
            var aesMgr = new AESManager();
            var email  = aesMgr.DecryptString(custEncrEmail);

            return(aesMgr.EncryptToString(email + "|" + DateTime.Now));
        }
Example #4
0
        public void SendActivationEmail(string activationCode, string username, string url, bool checkout = false)
        {
            var sptEmail    = new AESManager().DecryptString(ConfigurationManager.AppSettings.Get("SptEmail"));
            var sptPassword = new AESManager().DecryptString(ConfigurationManager.AppSettings.Get("SptPassword"));
            var email       = new AESManager().DecryptString(activationCode);

            using (MailMessage mm = new MailMessage(sptEmail, email))
            {
                mm.Subject = "Account Activation";
                string body = "Hey " + username + "!";
                body += "<br /><br />Please click the following link to activate your account";
                if (!checkout)
                {
                    body += "<br /><a href = '" + url + "Activation.aspx?ActivationCode=" + activationCode + "'>Click here to activate your account.</a>";
                }
                else
                {
                    body += "<br /><a href = '" + url + "Activation.aspx?ActivationCode=" + activationCode + "&Checkout=True'>Click here to activate your account.</a>";
                }
                body         += "<br /><br />Thanks";
                mm.Body       = body;
                mm.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient();
                smtp.Host      = "smtp.gmail.com";
                smtp.EnableSsl = true;
                NetworkCredential NetworkCred = new NetworkCredential(sptEmail, sptPassword);
                smtp.UseDefaultCredentials = true;
                smtp.Credentials           = NetworkCred;
                smtp.Port = 587;
                smtp.Send(mm);
            }
        }
Example #5
0
        public string GetCustEmailFromEmailingCode(string emailingCode, out DateTime requestedDate)
        {
            var aesMgr = new AESManager();
            var code   = aesMgr.DecryptString(emailingCode);

            requestedDate = Convert.ToDateTime(code.Split('|').Last());
            return(aesMgr.EncryptToString(code.Split('|').First()));
        }