Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2013
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. string FILENAME = Server.MapPath("~/GuestUserTemplate.txt");
  2. StreamReader objStreamReader = File.OpenText(FILENAME);
  3. string sEmailTemplate = "";
  4. string input = null;
  5. while ((input = objStreamReader.ReadLine()) != null)
  6. {
  7. sEmailTemplate = sEmailTemplate + input;
  8. }
  9. objStreamReader.Close();
  10.  
  11. /* send an email */
  12. MailMessage msg = new MailMessage();
  13. msg.IsBodyHtml = true;
  14. msg.To.Add(new MailAddress(sToEmail));
  15. msg.From = new MailAddress(sFromEmail);
  16. msg.Subject = sEmailSubject;
  17. msg.Body = sEmailTemplate;
  18. //try
  19. {
  20. client.Send(msg);
  21. }
  22. //catch (Exception excm)
  23. {
  24.  
  25. }
  26.  
  27. MIME-Version: 1.0
  28. Content-Type: text/html; charset=us-ascii
  29. Content-Transfer-Encoding: quoted-printable
  30.  
  31. Content-class: urn:content-classes:message
  32. MIME-Version: 1.0
  33. Content-Type: multipart/related;
  34. boundary="----_=_NextPart_001_01C9C98D.6552117E";
  35. type="multipart/alternative"
  36.  
  37. while ((input = objStreamReader.ReadLine()) != null)
  38. {
  39. sEmailTemplate = sEmailTemplate + input;
  40. }
  41.  
  42. sEmailTemplate = sEmailTemplate + objStreamReader.ReadToEnd();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement