Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (Consulta == "Aprobado") {
- MailMessage email = new MailMessage();
- email.To.Add(new MailAddress("xxxxxxxxx@gmail.com"));
- email.From = new MailAddress("xxxxxxxxxxx@gmail.com");
- email.Subject = "Asunto(Correo Prueba)";
- email.Body = "Contenido Prueba";
- email.IsBodyHtml = true;
- email.Priority = MailPriority.Normal;
- SmtpClient smtp = new SmtpClient();
- smtp.Host = "gmail.com";
- smtp.Port = 465;
- smtp.EnableSsl = false;
- smtp.UseDefaultCredentials = false;
- smtp.Credentials = new NetworkCredential("xxxxxxxxxxx@gmail.com", "xxxxxxxxx");
- try {
- smtp.Send(email);
- email.Dispose();
- this.Page.Response.Write("<script language='JavaScript'>window.alert('" +
- "Correo electrónico fue enviado satisfactoriamente" + "');</script>");
- } catch (Exception ex) {
- this.Page.Response.Write("<script language='JavaScript'>window.alert('" +
- "Error enviando correo" + "');</script>");
- this.Page.Response.Write("<script language='JavaScript'>window.alert('" +
- ex.Message.ToString() + "');</script>");
- }
- }
Add Comment
Please, Sign In to add comment