public async Task SendVerificationEmail(IdentityUserViewModel model) { try { var user = await _userManager.FindByEmailAsync(model.Email); if (user == null) { throw new Exception($"Unable to load user"); } var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); var callbackUrl = UrlHelperExtensions.EmailConfirmationLink(user.Id, code); var email = user.Email; await _emailSender.SendEmailAsync(email, "Confirm email", callbackUrl); _logger.LogInformation($"Verification email sent to {user.Id}."); } catch (Exception ex) { _logger.LogError(ex); } }