Guest User

Untitled

a guest
Mar 8th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. if (Consulta == "Aprobado") {
  2. MailMessage email = new MailMessage();
  3. email.To.Add(new MailAddress("xxxxxxxxx@gmail.com"));
  4. email.From = new MailAddress("xxxxxxxxxxx@gmail.com");
  5. email.Subject = "Asunto(Correo Prueba)";
  6. email.Body = "Contenido Prueba";
  7. email.IsBodyHtml = true;
  8. email.Priority = MailPriority.Normal;
  9.  
  10. SmtpClient smtp = new SmtpClient();
  11. smtp.Host = "gmail.com";
  12. smtp.Port = 465;
  13. smtp.EnableSsl = false;
  14. smtp.UseDefaultCredentials = false;
  15. smtp.Credentials = new NetworkCredential("xxxxxxxxxxx@gmail.com", "xxxxxxxxx");
  16.  
  17. try {
  18. smtp.Send(email);
  19. email.Dispose();
  20. this.Page.Response.Write("<script language='JavaScript'>window.alert('" +
  21. "Correo electrónico fue enviado satisfactoriamente" + "');</script>");
  22. } catch (Exception ex) {
  23. this.Page.Response.Write("<script language='JavaScript'>window.alert('" +
  24. "Error enviando correo" + "');</script>");
  25. this.Page.Response.Write("<script language='JavaScript'>window.alert('" +
  26. ex.Message.ToString() + "');</script>");
  27. }
  28.  
  29. }
Add Comment
Please, Sign In to add comment