コード例 #1
0
        protected void btnEnviar_Click(object sender, EventArgs e)
        {
            string email = this.txtEmail.Text;

            WebService.WebService ws = new WebService.WebService();

            string senhaRecuperada = ws.RecuperarSenha(email);

            string from = "*****@*****.**";
            string assunto = "Recuperação de senha - Controle de Gastos.";
            string body = "Sua senha foi recuperada com sucesso. <br /><strong>Senha: </strong>" + senhaRecuperada;
            string smtp = "";
            int porta = 0;
            string usuario = "";
            string senha = "";

            if (senhaRecuperada != string.Empty)
            {
                Email.EnvioDeEmail EnvMail = new Email.EnvioDeEmail();
                if (EnvMail.dispararEmail(email, string.Empty, string.Empty, from, assunto, body, 1, true, true, smtp, porta, usuario, senha))
                {
                    Response.Redirect("~/Usuario/SenhaSucesso.aspx");
                }
                else
                {
                    Response.Redirect("~/Usuario/Error.aspx");
                }
            }
            else
            {
                Response.Redirect("~/Usuario/Error.aspx");
            }
        }
コード例 #2
0
        protected void btnEnviar_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                string nome = this.txtNome.Text;
                string email = this.txtEmail.Text;
                string login = this.txtLogin.Text;
                string senha = this.txtSenha.Text;

                WebService.WebService ws = new WebService.WebService();

                bool result = ws.CadastrarUsuario(nome, email, login, senha);

                if (result)
                {
                    string from = "*****@*****.**";
                    string assunto = "Cadastro de Usuário - Controle de Gastos.";
                    string body = "Seu Cadastro no Controle de gastos foi realizado com sucesso. Acesse sua conta e comece a asar. http://controledegastos.com";
                    string smtp = "";
                    int porta = 0;
                    string usuario = "";
                    string senhaEmail = "";

                    Email.EnvioDeEmail EnvMail = new Email.EnvioDeEmail();
                    EnvMail.dispararEmail(email, string.Empty, string.Empty, from, assunto, body, 1, true, true, smtp, porta, usuario, senhaEmail);

                    Response.Redirect("~/Usuario/CadastroSucesso.aspx");
                }
            }
        }