| Name | +{req.Name} | +
| {req.Email} | +|
| Subject | +{req.Subject} | +
{req.Message}
+ """; + + await _emailApi.SendAsync(new SendEmailRequest + { + To = [_contact.ToEmail], + ReplyTo = req.Email, + Subject = $"{_contact.SubjectPrefix} {req.Subject}".Trim(), + HtmlBody = htmlBody + }, ct); + + _log.LogInformation("Contact email sent successfully from {SenderEmail}", req.Email); + } + + ///A new user has subscribed:
+| {req.Email} | +
| File | +{fileName} | +
| Downloaded at | +{DateTime.UtcNow:yyyy-MM-dd HH:mm:ss} UTC | +
| IP Address | +{userIp ?? "Unknown"} | +
—
"; + + var gaps = result.Gaps?.Count > 0 + ? "—
"; + + var recommendations = result.Recommendations?.Count > 0 + ? "—
"; + + // Render the HTML template with substituted values + // email.match.body is now stored as HTML in the database + var body = _emailTemplates.Render("email.match.body", language, + ("cvDocumentId", cvDocumentId), + ("jobLabel", jobLabel ?? "N/A"), + ("jobUrl", result.JobUrl ?? "N/A"), + ("score", result.Score.ToString()), + ("summary", WebUtility.HtmlEncode(result.Summary ?? string.Empty)), + ("strengths", strengths), + ("gaps", gaps), + ("recommendations", recommendations)); + + // Append the job search footer if link is provided + if (!string.IsNullOrWhiteSpace(jobSearchLink)) + { + body += _emailTemplates.Render("email.match.job-search-footer", language, + ("jobSearchLink", jobSearchLink), + ("expiryDays", expiryDays.ToString())); + } + + return body; + } + + ///