Exemple #1
0
        void enviarEmail(string email, int idUser)
        {
            System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
            LinkButton link = new LinkButton();

            link.Text                    = "Validar Cadastro";
            link.PostBackUrl             = "~/ConfirmarEmail.aspx";
            client.Host                  = "smtp.gmail.com";
            client.EnableSsl             = true;
            client.UseDefaultCredentials = false;
            client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "burger01");
            MailMessage mail = new MailMessage();

            mail.Sender = new System.Net.Mail.MailAddress("*****@*****.**", "TotemTree");
            mail.From   = new MailAddress("*****@*****.**", "TotemTree");
            mail.To.Add(new MailAddress(email, "RECEBEDOR"));
            mail.Subject = "TotemTree - Cadastro Efetuado";
            string url = "http://localhost:50965/ConfirmarEmail.aspx?MyU=" + idUser;

            mail.Body = " Mensagem do site:<br/> Olá! Bem vindo ao TotemTree! <br/> Para concluir o seu cadastro, por gentileza clique neste link de redirecionamento ao site: <a href=\'" + url + "'>Login</a> ";



            mail.Body = "<table align = 'center' border = '0' cellpadding = '0' cellspacing = '0' style = 'width:650px;' >" +
                        "<tbody>" +
                        "     <tr>" +
                        "<td align = 'center' colspan = '2' valign = 'top'><img alt = '' border = '0' src = 'https://i.ibb.co/hF7X83m/logo-Menor.png' style = 'display: block;'/></td>" +
                        "</tr>" +
                        "<td><br/></td>" +
                        "<tr> " +
                        " <td style='width: 350px; font - family: arial; font - weight: bold; font - size:25px; color: #000000;text-align: center;padding-bottom:15px'>Seja bem vindo ao Totem Tree</td>" +
                        "</tr>" +
                        " <td><br/></td>" +
                        "<tr>" +
                        "<td style='width: 350px; font - family: arial; font - size:18px; color: #000000;text-align: center;line-height:18px;padding-bottom:15px; line-height:25px'>Agora você já pode organizar melhor os seus estudos!<br/>Para a efetivação do seu cadastro, por favor, acesse o link abaixo:</td>" +
                        "</tr>" +
                        "<td><br/></td>" +
                        "</tbody>" +
                        "</table>" +
                        "<table align = 'center' border = '0' cellpadding = '0' cellspacing = '0' style = 'width:650px;'>" +
                        "<tbody>" +
                        "<td align = 'center'>" +
                        "<a href =' " + url + "' style = 'color: #000000;text-decoration: none;'>" +
                        "<table align = 'center' border = '0' cellpadding = '0' cellspacing = '0' style = 'height:35px;width:180px;'>" +
                        "<tbody>" +
                        "<tr><td style='font - family: arial; font - size:18px; color: #fff; background-color: #e67e22; text-align: center;line-height:13px; height:35px;width:180px;'>Acessar</td></tr>" +
                        "</tbody>" +
                        "</table>" +
                        "</a>" +
                        "</td>" +
                        "</tbody>" +
                        "</table>" +
                        "<table align = 'center' border = '0' cellpadding = '0' cellspacing = '0' style = 'width:650px;'>" +
                        "<tbody>" +
                        "<td><br/></td>" +
                        "<tr>" +
                        "<td style = 'width:350px;font-family: arial;font-size:18px;color: #000000;text-align: center;line-height:18px;padding-bottom:15px; line-height:25px'> Caso você não tenha solicitado este e-mail,<br/> favor desconsiderar.</td>" +
                        "</tr>" +
                        "</tbody>" +
                        "</table>";

            mail.IsBodyHtml = true;
            mail.Priority   = MailPriority.High;
            try
            {
                client.Send(mail);
            }
            catch (System.Exception erro)
            {
                Mensagem.ExibirAlerta(this, Mensagem.TipoMensagem.Erro, "Problemas no servidor de e-mail. E-mail não enviado");
            }
            finally
            {
                mail = null;
            }
        }
Exemple #2
0
        string enviarEmail(string email)
        {
            string password = RandomString(8, true);

            System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
            client.Host                  = "smtp.gmail.com";
            client.EnableSsl             = true;
            client.UseDefaultCredentials = false;
            string url = "http://*****:*****@gmail.com", "burger01");
            MailMessage mail = new MailMessage();

            mail.Sender = new System.Net.Mail.MailAddress("*****@*****.**", "TotemTree");
            mail.From   = new MailAddress("*****@*****.**", "TotemTree");
            mail.To.Add(new MailAddress(email, "RECEBEDOR"));
            mail.Subject = "TotemTree - Recuperação de senha";
            mail.Body    = "<table align = 'center' border = '0' cellpadding = '0' cellspacing = '0' style = 'width:650px;' >" +
                           "<tbody>" +
                           "     <tr>" +
                           "<td align = 'center' colspan = '2' valign = 'top'><img alt = '' border = '0' src = 'https://i.ibb.co/hF7X83m/logo-Menor.png' style = 'display: block;'/></td>" +
                           "</tr>" +
                           "<td><br/></td>" +
                           "<tr> " +
                           "<td style = 'width:350px;font-family: arial;font-weight: bold;font-size:25px;color: #000000;text-align: center;padding-bottom:15px' > Perdeu a sua senha? </td> " +
                           "</tr>" +
                           " <td><br/></td>" +
                           "<tr>" +
                           "<td style = 'width:350px;font-family: arial;font-size:18px;color: #000000;text-align: center;line-height:18px;padding-bottom:15px; line-height:25px' > Sua senha foi redefinida para <b> " + password + "</b>. Para alterá-la, basta acessar a área de configurações de sua página.</td>" +
                           "</tr>" +
                           "<td><br/></td>" +
                           "</tbody>" +
                           "</table>" +
                           "<table align = 'center' border = '0' cellpadding = '0' cellspacing = '0' style = 'width:650px;'>" +
                           "<tbody>" +
                           "<td align = 'center'>" +
                           "<a href =' " + url + "' style = 'color: #000000;text-decoration: none;'>" +
                           "<table align = 'center' border = '0' cellpadding = '0' cellspacing = '0' style = 'height:35px;width:180px;'>" +
                           "<tbody>" +
                           "<tr><td style = 'font-family: arial;font-size:18px;color: #fff; background-color: #e67e22; text-align: center;line-height:13px; height:35px;width:180px;'> Acessar </td></tr>" +
                           "</tbody>" +
                           "</table>" +
                           "</a>" +
                           "</td>" +
                           "</tbody>" +
                           "</table>" +
                           "<table align = 'center' border = '0' cellpadding = '0' cellspacing = '0' style = 'width:650px;'>" +
                           "<tbody>" +
                           "<td><br/></td>" +
                           "<tr>" +
                           "<td style = 'width:350px;font-family: arial;font-size:18px;color: #000000;text-align: center;line-height:18px;padding-bottom:15px; line-height:25px'> Caso você não tenha solicitado este e-mail,<br/> favor desconsiderar.</td>" +
                           "</tr>" +
                           "</tbody>" +
                           "</table>";

            mail.IsBodyHtml = true;
            mail.Priority   = MailPriority.High;
            try
            {
                client.Send(mail);
                this.ExibirAlerta(Mensagem.TipoMensagem.Sucesso, "Email enviado ao usuário");
            }
            catch (System.Exception erro)
            {
                Mensagem.ExibirAlerta(this, Mensagem.TipoMensagem.Erro, "Problemas no servidor de e-mail. E-mail não enviado");
            }
            finally
            {
                mail = null;
            }
            return(password);
        }