Hi {System.Net.WebUtility.HtmlEncode(firstName)},
" + $"A password reset was requested for your Powder Coating Logix account.
" + $"" + $"Or copy this link: {System.Net.WebUtility.HtmlEncode(resetUrl)}
" + $"This link expires in 24 hours.
"; var (success, error) = await _emailService.SendEmailAsync( user.Email!, user.FullName, subject, plain, html); if (success) { _logger.LogInformation("Password reset email sent to {Email} by {Admin}", user.Email, User.Identity?.Name); TempData["Success"] = $"Password reset email sent to {user.Email}."; } else { _logger.LogWarning("Failed to send password reset email to {Email}: {Error}", user.Email, error); TempData["Error"] = "Failed to send email. Please try again or reset the password manually."; } } catch (Exception ex) { _logger.LogError(ex, "Error sending password reset email for user {UserId}", id); TempData["Error"] = "An error occurred while sending the reset email."; } var referer = Request.Headers["Referer"].ToString(); if (!string.IsNullOrEmpty(referer) && Uri.TryCreate(referer, UriKind.Absolute, out var refUri) && string.Equals(refUri.Host, Request.Host.Host, StringComparison.OrdinalIgnoreCase)) { return LocalRedirect(refUri.PathAndQuery); } return RedirectToAction(nameof(Index)); } }