public string CreateRegistrationVerificationEmail(UserMaster user, string token) { AesAlgorithm aesAlgorithm = new AesAlgorithm(); var key = string.Join(":", new string[] { DateTime.Now.Ticks.ToString(), user.UserId.ToString() }); var encrypt = aesAlgorithm.EncryptToBase64String(key); var linktoverify = $"{_appSettings.VerifyRegistrationUrl}?key={HttpUtility.UrlEncode(encrypt)}&hashtoken={HttpUtility.UrlEncode(token)}"; var stringtemplate = new StringBuilder(); stringtemplate.Append("Welcome"); stringtemplate.Append("<br/>"); stringtemplate.Append($"Dear {user.FirstName}{user.LastName}"); stringtemplate.Append("<br/>"); stringtemplate.Append("Thanks for joining Web Secure."); stringtemplate.Append("<br/>"); stringtemplate.Append("To activate your Web Secure account, please confirm your email address."); stringtemplate.Append("<br/>"); stringtemplate.Append("<a target='_blank' href=" + linktoverify + ">Confirm Email</a>"); stringtemplate.Append("<br/>"); stringtemplate.Append("Yours sincerely,"); stringtemplate.Append("<br/>"); stringtemplate.Append("Frapper"); stringtemplate.Append("<br/>"); return(stringtemplate.ToString()); }
public string SendVerificationEmail(RegisterViewModel registerViewModel, string token, long userid) { AesAlgorithm aesAlgorithm = new AesAlgorithm(); var key = string.Join(":", new string[] { DateTime.Now.Ticks.ToString(), userid.ToString() }); var encrypt = aesAlgorithm.EncryptToBase64String(key); var linktoverify = _appSettings.VerifyRegistrationUrl + "?key=" + HttpUtility.UrlEncode(encrypt) + "&hashtoken=" + HttpUtility.UrlEncode(token); var stringtemplate = new StringBuilder(); stringtemplate.Append("Welcome"); stringtemplate.Append("<br/>"); stringtemplate.Append("Dear " + registerViewModel.FullName); stringtemplate.Append("<br/>"); stringtemplate.Append("Thanks for joining Web Secure."); stringtemplate.Append("<br/>"); stringtemplate.Append("To activate your Web Secure account, please confirm your email address."); stringtemplate.Append("<br/>"); stringtemplate.Append("<a target='_blank' href=" + linktoverify + ">Confirm Email</a>"); stringtemplate.Append("<br/>"); stringtemplate.Append("Yours sincerely,"); stringtemplate.Append("<br/>"); stringtemplate.Append("Ticket's"); stringtemplate.Append("<br/>"); return(stringtemplate.ToString()); }
public async Task SendVerificationEmailasync(string emailid, string name, string token, string sendingType, string userid) { try { AesAlgorithm aesAlgorithm = new AesAlgorithm(); var key = string.Join(":", new string[] { DateTime.Now.Ticks.ToString(), userid }); var encrypt = aesAlgorithm.EncryptToBase64String(key); var linktoverify = ConfigurationManager.AppSettings["VerifyRegistrationURL"] + "?key=" + HttpUtility.UrlEncode(encrypt) + "&hashtoken=" + HttpUtility.UrlEncode(token); if (emailid != null) { var generalsetting = GetGeneralSetting(); if (generalsetting != null) { if (generalsetting.EnableEmailFeature) { IProcessSettings processSettings = new ProcessSettingsConcrete(); var settingobject = processSettings.GetDefaultEmailSettings(); string from = generalsetting.Email; if (settingobject != null) { MailMessage message = new MailMessage(); SmtpClient smtpClient = new SmtpClient(); try { MailAddress fromAddress = new MailAddress(from); message.From = fromAddress; message.To.Add(emailid); message.Subject = "Welcome to Ticket's"; message.IsBodyHtml = true; message.Body = SendVerificationEmail(name, linktoverify); // We use mail as our smtp client smtpClient.Host = settingobject.Host; smtpClient.Port = Convert.ToInt32(settingobject.Port); smtpClient.EnableSsl = settingobject.SslProtocol == "Y" ? true : false; smtpClient.UseDefaultCredentials = true; smtpClient.Credentials = new System.Net.NetworkCredential(settingobject.Username, settingobject.Password); await smtpClient.SendMailAsync(message); } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); } } } } } } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); } }
public string SendVerificationEmail(User user, string token) { AesAlgorithm aesAlgorithm = new AesAlgorithm(); var key = string.Join(":", new string[] { DateTime.Now.Ticks.ToString(), user.UserId.ToString() }); var encrypt = aesAlgorithm.EncryptToBase64String(key); var linktoverify = _appSettings.VerifyResetPasswordUrl + "?key=" + HttpUtility.UrlEncode(encrypt) + "&hashtoken=" + HttpUtility.UrlEncode(token); var stringtemplate = new StringBuilder(); stringtemplate.Append("Welcome"); stringtemplate.Append("<br/>"); stringtemplate.Append("Dear " + user.FullName); stringtemplate.Append("<br/>"); stringtemplate.Append("Please click the following link to reset your password."); stringtemplate.Append("<br/>"); stringtemplate.Append("Reset password link : <a target='_blank' href=" + linktoverify + ">Link</a>"); stringtemplate.Append("<br/>"); stringtemplate.Append("If the link does not work, copy and paste the URL into a new browser window. The URL will expire in 24 hours for security reasons."); stringtemplate.Append("<br/>"); stringtemplate.Append("Best regards,"); stringtemplate.Append("Saineshwar Begari"); stringtemplate.Append("<br/>"); return(stringtemplate.ToString()); }
public string CreateVerificationEmail(UserMaster user, string token) { AesAlgorithm aesAlgorithm = new AesAlgorithm(); var key = string.Join(":", new string[] { DateTime.Now.Ticks.ToString(), user.UserId.ToString() }); var encrypt = aesAlgorithm.EncryptToBase64String(key); var linktoverify = $"{_appSettings.VerifyResetPasswordUrl}?key={HttpUtility.UrlEncode(encrypt)}&hashtoken={HttpUtility.UrlEncode(token)}"; var stringtemplate = new StringBuilder(); stringtemplate.Append("Welcome"); stringtemplate.Append("<br/>"); stringtemplate.Append($"Dear {user.FirstName}{user.LastName}"); stringtemplate.Append("<br/>"); stringtemplate.Append("Please click the following link to reset your password."); stringtemplate.Append("<br/>"); stringtemplate.Append($"Reset password link : <a target='_blank' href={linktoverify}>Link</a>"); stringtemplate.Append("<br/>"); stringtemplate.Append("If the link does not work, copy and paste the URL into a new browser window. The URL will expire in 24 hours for security reasons."); stringtemplate.Append("<br/>"); stringtemplate.Append("Best regards,"); stringtemplate.Append("Frapper"); stringtemplate.Append("<br/>"); return(stringtemplate.ToString()); }