public async Task <IActionResult> OnPostSendVerificationEmailAsync() { if (!ModelState.IsValid) { return(Page()); } var user = await _userManager.GetUserAsync(User); if (user == null) { return(NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'.")); } string name = User.Identity.Name; var userId = await _userManager.GetUserIdAsync(user); var email = await _userManager.GetEmailAsync(user); var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); var callbackUrl = Url.Page( "/Account/ConfirmEmail", pageHandler: null, values: new { userId = userId, code = code }, protocol: Request.Scheme); //await _emailSender.SendEmailAsync( // email, // "Confirm your email", // $"Please confirm your account by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>."); string textInEmail = @"Hello, " + name + ". Please confirm your account by clicking \r\r" + " <a href=\"" + callbackUrl + "\">here</a>\r\rIf you did not request this, you can ignore this safely.\rHave a pleasant day."; var sendEmail = new SendEmail(); sendEmail.ConfirmEmail(name, email, textInEmail, _configuration["RSHAEmail:EmailPassword"]); StatusMessage = "Verification email sent. Please check your email."; return(RedirectToPage()); }