/*public static string GetAccountCreationHTML(string customerUID, string verificationCode,string html) { string url = HttpContext.Current.Request.Url.ToString(); string[] paths = url.Split('/'); url = url.Replace(paths[paths.Length - 1], "VerifyEmail.aspx"); url += "?" + WebConstants.Request.USER_UID + "=" + customerUID; url += "&" + WebConstants.Request.VERIFICATION_CODE + "=" + Utility.GetMd5Sum(verificationCode); EmailTemplateFactory.Instance.Paramters.Add("##URL##", url); EmailTemplates.EmailTemplateEntityRow emailTemplate = EmailTemplateFactory.Instance.GetEmailContents(WebConstants.TemplateNames.ACTIVATION); if (emailTemplate != null) { html = emailTemplate.html.Replace( html = ReplaceAttributes(html); } else { html = "Thank you for registering with Simplicity4Business. <br/> <br/>" + " Please click the following URL to activate your account. <br/><br/>" + " <a href='" + url + "'>" + url + "</a>"; } return html; } public static string GetAccountCreationHTML(string password, string html) { string url = HttpContext.Current.Request.Url.ToString(); string[] paths = url.Split('/'); url = url.Replace(paths[paths.Length - 1], "VerifyEmail.aspx"); url += "?" + WebConstants.Request.USER_UID + "=" + customerUID; url += "&" + WebConstants.Request.VERIFICATION_CODE + "=" + Utility.GetMd5Sum(verificationCode); html = html.Replace("##URL##", url); html = ReplaceAttributes(html); return html; }*/ public static void SendAccountCreationEmail(User customer, string password) { if (customer != null) { MailMessage message = new MailMessage(); message.To.Add(new MailAddress(customer.Email)); string url = HttpContext.Current.Request.Url.ToString(); string[] paths = url.Split('/'); url = url.Replace(paths[paths.Length - 1], "VerifyEmail.aspx"); url += "?" + WebConstants.Request.USER_UID + "=" + customer.UserUID; url += "&" + WebConstants.Request.VERIFICATION_CODE + "=" + Utility.GetMd5Sum(customer.VerificationCode); EmailTemplateFactory templateFactory = new EmailTemplateFactory(customer); templateFactory.Paramters["##PASSWORD##"] = password; templateFactory.Paramters.Add("##URL##", url); EmailTemplate emailTemplate = templateFactory.GetEmailContents(WebConstants.TemplateNames.ACTIVATION); if (emailTemplate != null) { message.Body = emailTemplate.HTML; message.Subject = emailTemplate.Subject; } else { message.Body = "Thank you for registering with Simplicity4Business. <br/> <br/>" + " Please click the following URL to activate your account. <br/><br/>" + " <a href=' " + url + "'>" + url + "</a>"; message.Subject = "Activation Code for Simplicity for Business"; } message.IsBodyHtml = true; SendEmail(message); } }
public static void SendPasswordEmail(string emailAddress, string password) { MailMessage message = new MailMessage(); message.To.Add(new MailAddress(emailAddress)); EmailTemplateFactory templateFactory = new EmailTemplateFactory(); templateFactory.Paramters.Add("##PASSWORD##", password); EmailTemplate emailTemplate = templateFactory.GetEmailContents(WebConstants.TemplateNames.PASSWORD); if (emailTemplate != null) { message.Body = emailTemplate.HTML; message.Subject = emailTemplate.Subject; } else { message.Subject = "Simplicity Account Password"; message.Body = "Your password is " + password; } message.IsBodyHtml = true; //+ " Or click on the following link: <br/>" + url; SendEmail(message); }