public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; try { string email = context.Request.Params["email"]; string name = context.Request.Params["name"]; string check = context.Request.Params["check"]; string product = context.Request.Params["product"]; if (check != "vertex5L34") { throw new Exception("Bad code"); } LicenseData licdata = new LicenseData(); string license = LicenseTool.CreateLicense(name, email, "name", product + "-eval", null, licdata); context.Response.Write(license); } catch (Exception err) { context.Response.Write(err.Message); } }
public static void SendLicense(string name, string email, string targetEmail, string text, string product) { LicenseData licdata = new LicenseData(); string license = LicenseTool.CreateLicense(name, email, "name", product, null, licdata); MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(license)); SmtpClient client = new SmtpClient("mail.dzavy.net"); client.UseDefaultCredentials = false; client.Credentials = new NetworkCredential("*****@*****.**", "kijokGawg9"); XmlElement prod = LicenseTool.GetProductXml("name", product); MailMessage message = new MailMessage("*****@*****.**", targetEmail, String.Format("DatAdmin License - {0}", prod.GetAttribute("text")), text); Attachment attach = new Attachment(ms, "datadmin.license", "application/octet-stream"); message.Attachments.Add(attach); client.Send(message); ms.Position = 0; string copyInfo = String.Format("Name: {0}\r\nE-mail: {1}\r\nProduct: {2}\r\nLICENSE:\r\n{3}\r\n\r\n", name, email, prod.GetAttribute("text"), licdata.LicenseXml); MailMessage copyMessage = new MailMessage("*****@*****.**", "*****@*****.**", String.Format("DatAdmin License COPY - {0}", prod.GetAttribute("text")), copyInfo + text); copyMessage.Attachments.Add(attach); client.Send(copyMessage); }