public async Task <bool> ConfirmEmailAsync(string email, string code) { var user = await _userManager.FindByEmailAsync(email); code = WebUtility.UrlDecode(code); code = code.Replace(' ', '+'); var result = await _userManager.ConfirmEmailAsync(user, code); if (result.Succeeded) { var resetCode = await _userManager.GeneratePasswordResetTokenAsync(user); var fullname = user.FirstName + " " + user.LastName; var mailContent = await EmailBodyCreator.CreateSetPasswordEmailBody(Utilities.GetCurrHost(_httpContext), fullname, user.Email, resetCode); var fullName = user.FirstName + " " + user.LastName; await _emailService.SendMailAsync(new List <MailAddress>() { new MailAddress(user.Email, fullName) }, null, null, AppCommon.AppName + " - Set Username & Password", mailContent, null); return(true); } return(false); }