Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. MailMessage activationMail = new MailMessage();
  2. activationMail.From = new MailAddress("no-reply@mydomain.com", "MyGame");
  3. activationMail.To.Add(RegistrationEmail.Text);
  4. StreamReader sRead = new StreamReader(Server.MapPath("~/Mails/ActivationMail.html"));
  5. string readFile = sRead.ReadToEnd();
  6. string Strcontent = "";
  7. Strcontent = readFile;
  8. Strcontent = Strcontent.Replace("[Name]", RegistrationRealName.Text);
  9. Strcontent = Strcontent.Replace("[Username]", RegistrationUsername.Text);
  10. Strcontent = Strcontent.Replace("[Password]", RegistrationPasswordCreate.Text);
  11. Strcontent = Strcontent.Replace("[useractivation]", useractivation);
  12. Strcontent = Strcontent.Replace("[Site]", site);
  13. Strcontent = Strcontent.Replace("[Facebook]", "facebook");
  14. activationMail.Subject = "My Game - Registration";
  15. activationMail.Body = Strcontent.ToString();
  16. sRead.Close();
  17. activationMail.IsBodyHtml = true;
  18. activationMail.BodyEncoding = UTF8Encoding.UTF8;
  19. SmtpClient client = new SmtpClient();
  20. client.Host = "mydomain";
  21. NetworkCredential cr = new NetworkCredential();
  22. cr.UserName = "User from AD DS";
  23. cr.Password = "Password of User";
  24. client.UseDefaultCredentials = false;
  25. client.DeliveryMethod = SmtpDeliveryMethod.Network;
  26. client.Port = 25;
  27. client.Timeout = 10000;
  28. client.Send(activationMail);
  29.  
  30. <mailSettings>
  31. <smtp from="no-reply@mydomain">
  32. <network defaultCredentials="false" host="localhost" />
  33. </smtp>
  34. </mailSettings>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement