Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. int row2 = e.RowIndex;
  2. string em = GridView1.Rows[row2].Cells[2].Text;
  3. MailUtility mu = new MailUtility();
  4. mu.SendMail(em, "thank you", "thank you");
  5.  
  6.  
  7. using System;
  8. using System.Data;
  9. using System.Configuration;
  10. using System.Web;
  11. using System.Web.Security;
  12. using System.Web.UI;
  13. using System.Web.UI.WebControls;
  14. using System.Web.UI.WebControls.WebParts;
  15. using System.Web.UI.HtmlControls;
  16. using System.Net.Mail;
  17. using System.Net;
  18. using System.Net.Security;
  19. using System.Security.Cryptography.X509Certificates;
  20.  
  21. /// <summary>
  22. /// Summary description for MailUtility
  23. /// </summary>
  24. public class MailUtility
  25. {
  26.  
  27. public void SendMail(string sendTo, string subject, string body)
  28. {
  29. MailMessage m = new MailMessage();
  30. m.From = new MailAddress("BarBichachiSite@gmail.com",
  31. "אני");
  32. m.To.Add(new MailAddress(sendTo));
  33. m.Subject = subject;
  34. m.Body = body;
  35. SmtpClient sc = new SmtpClient();
  36. sc.EnableSsl = true;
  37. sc.Send(m);
  38. }
  39.  
  40.  
  41.  
  42.  
  43.  
  44. <system.net>
  45. <mailSettings>
  46. <smtp>
  47. <network host="smtp.gmail.com" port="587" userName="BarBichachiSite@gmail.com" password="1234567d" />
  48. </smtp>
  49. </mailSettings>
  50. </system.net>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement