Пример #1
0
        public static void EnviarCorreo(Tipo tipo, Usuario usu)
        {
            var from = "*****@*****.**";
            var to = usu.Correo;
            const string password = "******";
            string subject = string.Empty;
            string body = string.Empty;

            switch (tipo)
            {
                case Tipo.NuevoUsuario:
                    subject = "Registro";
                    body = "Bienvenido " + usu.Nombre + " " + usu.Apellido + "\n";
                    body += "Su contraseña es: " + usu.Password + "\n\n";
                    body += "Objeto de Aprendizaje Redes";
                    break;

                case Tipo.Recuperacion:
                    break;

                default:
                    break;
            }

            var smtp = new SmtpClient();
            {
                smtp.Host = "smtp.gmail.com";
                smtp.Port = 587;
                smtp.EnableSsl = true;
                smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                smtp.Credentials = new NetworkCredential(from, password);
                smtp.Timeout = 20000;
            }

            smtp.Send(from, to, subject, body);
        }
Пример #2
0
 public RegistroViewModel()
 {
     Usuario = new Usuario();
 }