Esempio n. 1
0
        protected void btnForgotEmail_Click(object sender, EventArgs e)
        {
            ForgotEmail ctrl = (ForgotEmail)this.Page.LoadControl("/Controls/Templates/ForgotEmail.ascx");

            ctrl.UserName = "******";
            ctrl.Password = "******";
            ctrl.SetProperties();

            phControl.Controls.Add(ctrl);
        }
Esempio n. 2
0
        public bool SendForgotEmail(string userName, string password, string toEmail)
        {
            var subject = _AppConfigManager.AppSettings["ForgotSubject"];

            ForgotEmail ctrl = (ForgotEmail)_Page.LoadControl("/Controls/Templates/ForgotEmail.ascx");

            ctrl.UserName = userName;
            ctrl.Password = password;
            ctrl.SetProperties();

            var body = RenderControl(ctrl);

            MailMessage mailObj = new MailMessage(_FromEmail, toEmail, subject, body);

            return(SendEmail(mailObj, true));
        }
Esempio n. 3
0
        private string CreateBody(string userName, string password)
        {
            StringBuilder sb = new StringBuilder();

            // Load the control
            ForgotEmail ctrl = (ForgotEmail)LoadControl("~/Controls/Templates/ForgotEmail.ascx");

            ctrl.UserName = userName;
            ctrl.Password = password;
            ctrl.SetProperties();

            // Render the control into the stringbuilder
            StringWriter     sw  = new StringWriter(sb);
            Html32TextWriter htw = new Html32TextWriter(sw);

            ctrl.RenderControl(htw);

            // Get full body text
            return(sb.ToString());
        }