Kind: Service
Source: Pams/Logic/Pams.Email/Pams.Email.csproj (line 1)
Part of: Pams
NuGet package dependency
log4net is a NuGet package dependency in Pams.Email that writes application log events from the email component. It supports recording errors, operational messages, and diagnostic context while email processing runs.
Diagram
mermaidflowchart LR Client[JavaScript client] --> EmailApi[Email API] EmailApi --> EmailService[Pams.Email service] EmailService --> Log4Net[log4net] Log4Net --> LogOutput[Configured log output] EmailService --> MailProvider[Mail provider]
Usage
tsasync function sendEmail(message: {
to: string;
subject: string;
body: string;
}) {
const response = await fetch("/api/email/send", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(message),
});
if (!response.ok) {
const error = await response.text();
console.error("Email request failed:", error);
throw new Error(error);
}
return response.json();
}
AI Coding Instructions
- Keep
log4netusage within the .NET email service; JavaScript clients should call the email API rather than reference the NuGet package. - Log failures with enough request and email context to diagnose issues, but do not log email bodies, credentials, tokens, or sensitive recipient data.
- Follow the existing
log4netconfiguration and logger naming patterns in thePams.Emailproject. - Record exceptions before returning an error response so mail-provider failures are available in configured log output.
Was this page helpful?