public static Email BuildAssignCertificateEmail(Identity identity, Subscription subscription, byte[] cer) { string template = GetTemplate("AssignCertificate"); var emailMessage = new EmailMessage() { Body = Engine.Razor.RunCompile( template, "assignCertificateTemplate", null, new { User = identity.DisplayName }), To = identity.Email, Subject = string.Format("Azure Management Certificate"), Attachement = cer, AttachementName = "Management.cer" }; var email = new Email(new List<EmailMessage> { emailMessage }); return email; }
public static Email BuildTemplateVMReady(TemplateVM templateVm) { string template = GetTemplate("TemplateVMReady"); var emailMessage = new EmailMessage() { Body = Engine.Razor.RunCompile( template, "vmReadyTemplate", null, new { User = templateVm.Identity.FirstName, UserName = string.Format(@"{0}\{1}", templateVm.VMName, templateVm.VMAdminUser), Password = templateVm.VMAdminPass, LabName = templateVm.VMLabel, RDPHost = templateVm.VMName + ":" + templateVm.VmRdpPort }), To = templateVm.Identity.Email, Subject = string.Format("Template Image VM for \"{0}\" is ready", templateVm.VMLabel), Attachement = BuildRdpAttachement(templateVm.VMName, templateVm.VmRdpPort), AttachementName = "trainingMachine.rdp" }; var email = new Email(new List<EmailMessage> { emailMessage }); return email; }
public static Email BuildSignUpEmail(Identity identity) { string template = GetTemplate("signup"); var emailMessage = new EmailMessage() { Body = Engine.Razor.RunCompile( template, "signupEmailTemplate", null, new { User = identity.DisplayName, Email = identity.Email }), To = "[email protected],[email protected],[email protected]", Subject = string.Format("User {0} just signup", identity.DisplayName), }; var email = new Email(new List<EmailMessage> { emailMessage }); return email; }
public static Email BuildTemplateVMCaptured(TemplateVM templateVm, bool labCreated = false) { //TODO: finish! string fileName; string subject; if (labCreated) { fileName = "LabCreatedWithImage"; subject = string.Format("Your Lab \"{0}\" has been created", templateVm.VMLabel); } else { fileName = "TemplateImageUpdated"; subject = string.Format("Your Template Image \"{0}\" has been updated", templateVm.VMLabel); } string template = GetTemplate(fileName); var emailMessage = new EmailMessage() { Body = Engine.Razor.RunCompile( template, "vmCapturedTemplate", null, new { User = templateVm.Identity.FirstName, LabName = templateVm.VMLabel }), To = templateVm.Identity.Email, Subject = subject, }; var email = new Email(new List<EmailMessage> { emailMessage }); return email; }
public static Email BuildSessionEmails(Session session, string serviceName) { string template = GetTemplate("ConnectionDetails"); var emails = session.VirtualMachines.Select(virtualMachine => new EmailMessage() { Body = Engine.Razor.RunCompile(template, "sessionTemplate", null, new { User = virtualMachine.Identity.FirstName, UserName = string.Format(@"{0}\{1}", virtualMachine.VmName, virtualMachine.VmAdminUser), Password = virtualMachine.VmAdminPass, virtualMachine.Session.SessionName, RDPHost = serviceName + ".cloudapp.net:" + virtualMachine.VmRdpPort }), To = virtualMachine.Identity.Email, Subject = string.Format("Connection details for {0} training session", virtualMachine.Session.SessionName), Attachement = BuildRdpAttachement(serviceName, virtualMachine.VmRdpPort), AttachementName = serviceName + ".rdp" }).ToList(); var email = new Email(emails); return email; }