Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. // stuff......
  2.  
  3. return SendCreationMail(Membership.GetUser((Guid)request.UserEntityId), request, new Control());
  4. }
  5.  
  6. private const string TemplateRoot = "~/app_shared/templates/mail/";
  7. private const string ServerRoot = TemplateRoot + "server/";
  8.  
  9. public static bool SendCreationMail(MembershipUser user, IServerAccountRequest request, Control owner)
  10. {
  11. var definition = new MailDefinition { BodyFileName = string.Concat(ServerRoot, "creation.htm"), IsBodyHtml = true };
  12. var subject = "New {0} account created!".FormatWith(request.ServerApplicationContract.Id);
  13.  
  14. var data = ExtendedData(DefaultData, subject, user);
  15.  
  16. data.Add("<%ServerApplication%>", request.ServerApplicationContract.Id);
  17. data.Add("<%ServerApplicationName%>", request.ServerApplicationContract.ApplicationName);
  18. data.Add("<%AccountUsername%>", request.AccountUsername);
  19.  
  20. data.Add("<%ServerInfo%>", "/server/{0}/info".FormatWith(request.ServerApplicationContract.Id.ToLower()));
  21.  
  22. return definition.CreateMailMessage(user.Email, data, owner).Send(subject, ApplicationConfiguration.MailSenderDisplayName);
  23. }
  24.  
  25. Page page = new Page();
  26.  
  27. Test test = (Test)page.LoadControl("Test.ascx");
  28.  
  29. return definition.CreateMailMessage(user.Email, data, test).Send(subject, ApplicationConfiguration.MailSenderDisplayName);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement