public IHttpActionResult SendEmailForgotPassword(ForgotPasswordDto dtoForgotPassword) { var dtoBase = new DtoBase(); const string randomPassword = "******"; var user = _userService.FirstOrDefault(o => o.Email == dtoForgotPassword.Email); if (user != null) { var courier = _courierService.GetById(user.Id); if (courier != null) { var webLink = AppSettingsReader.GetValue("Url", typeof(String)) as string; var urlSignIn = webLink + "/Authentication/SignIn"; var imgSrc = webLink + "/Content/quickspatch/img/logo-o.svg"; var urlChangePass = webLink + "/Authentication/ChangeRestorePassword?code=" + PasswordHelper.HashString(user.Id.ToString(), user.UserName); var fromEmail = AppSettingsReader.GetValue("EmailFrom", typeof(String)) as string; var displayName = AppSettingsReader.GetValue("EmailFromDisplayName", typeof(String)) as string; var franchiseeConfiguration = _franchiseeConfigurationService.GetFranchiseeConfiguration(); var franchiseeName = franchiseeConfiguration != null ? franchiseeConfiguration.Name : ""; var emailContent = TemplateHelpper.FormatTemplateWithContentTemplate( TemplateHelpper.ReadContentFromFile(TemplateConfigFile.RestorePassword, true), new { img_src = imgSrc, full_name = Framework.Utility.CaculatorHelper.GetFullName(user.FirstName, user.MiddleName, user.LastName), web_link = webLink, user_name = user.UserName, url_change_pass = urlChangePass, franchisee_Name = franchiseeName, url_sign_in = urlSignIn }); // send email _emailHandler.SendEmail(fromEmail, new[] { user.Email }, SystemMessageLookup.GetMessage("SubjectToSendEmailForCreateUser"), emailContent, true, displayName); dtoBase.Id = 1; } } else { dtoBase.Id = 2; } return(Ok(dtoBase)); //return Json(new { }, JsonRequestBehavior.AllowGet); }
public void ShouldSendEmail() { _sut.SendEmail(); }
public void Create(Inquiry inquiry) { Console.WriteLine(string.Format("User sent inquiry: {0}", inquiry.ToString())); _emailHandler.SendEmail(inquiry); _iPushNotificationHandler.SendNotification(inquiry); }