Пример #1
0
        public bool SendForgotPasswordEmail(string name, string email, string resetPasswordHash)
        {
            try
            {
                ForgotPasswordModel forgotPasswordModel = new ForgotPasswordModel()
                {
                    Name = name,
                    ResetPasswordHash = resetPasswordHash,
                    ClientUrl = "http://" + HttpContext.Current.Request.Url.Authority.ToString()
                };

                String messageBody = generateEmailBody(Manager.Properties.Resources.ForgotPasswordTemplate.ToString(), forgotPasswordModel);

                SendMessage("*****@*****.**", "*****@*****.**", new String[1] { email }, null, null, "Reset Your Vestn Account Password!", messageBody);

                return true;
            }
            catch (Exception e)
            {
                logAccessor.CreateLog(DateTime.Now, this.GetType().ToString() + "." + System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), e.ToString());
                return false;
            }
        }
Пример #2
0
 //[ExcludeFromCodeCoverage]
 //public bool SendSiteFeedbackEmail(string name, string useremail, string message)
 //{
 //    try
 //    {
 //        String messageBody = message;
 //        SendMessage("*****@*****.**", "*****@*****.**", new String[1] { "*****@*****.**" }, null, null, "Feedback from " + name, "User name: " + name + " User email: " + useremail + " Message: " + messageBody);
 //        return true;
 //    }
 //    catch (Exception e)
 //    {
 //        logAccessor.CreateLog(DateTime.Now, this.GetType().ToString() + "." + System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), e.ToString());
 //        return false;
 //    }
 //}
 private string generateEmailBody(string template, ForgotPasswordModel model)
 {
     try
     {
         return Razor.Parse(template, model);
     }
     catch (Exception ex)
     {
         logAccessor.CreateLog(DateTime.Now, this.GetType().ToString() + "." + System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), ex.ToString());
         return ex.Message;
     }
 }