# Pams.Email

**Kind:** Module

**Source:** `Pams/Logic/Pams.Email/Pams.Email.csproj` (line 1)

**Part of:** [Pams](subsystem-pams)

.NET project in solution

`Pams.Email` is a .NET project within the Pams solution that groups email-related application code. A host project references this module, supplies configuration and dependencies, and invokes its email behavior as part of the wider application flow.

## Diagram

```mermaid
graph TD
    Solution[Pams solution] --> EmailProject[Pams.Email project]
    EmailProject --> EmailCode[Email-related .NET code]
    HostProject[Referencing host project] --> EmailProject
    HostProject --> Client[Application client]
```

## Usage

```ts
type SendEmailRequest = {
  to: string;
  subject: string;
  body: string;
};

export async function sendEmail(
  request: SendEmailRequest,
): Promise<void> {
  // The host application should expose Pams.Email through its own API.
  const response = await fetch("/api/email/send", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify(request),
  });

  if (!response.ok) {
    throw new Error("Email request failed");
  }
}

await sendEmail({
  to: "user@example.com",
  subject: "Account update",
  body: "Your account details have been updated.",
});
```

## AI Coding Instructions

- Keep email behavior inside `Pams.Email`; let host projects handle HTTP endpoints, dependency registration, and environment configuration.
- Reference the `Pams.Email` project from the consuming .NET project instead of duplicating email logic in the host.
- Do not expose email provider details directly to JavaScript clients; call an application API that is backed by the .NET host.
- Keep request validation and error handling explicit at the host boundary before invoking email-related code.

## Relationships

- DEPENDS_ON → `log4net`
- DEPENDS_ON → `Microsoft.Exchange.WebServices`
- DEPENDS_ON → `Microsoft.Exchange.WebServices.Auth`
- DEPENDS_ON → `Microsoft.Threading.Tasks`
- DEPENDS_ON → `Microsoft.Threading.Tasks.Extensions`
- DEPENDS_ON → `Microsoft.Threading.Tasks.Extensions.Desktop`
- DEPENDS_ON → `Newtonsoft.Json`
- DEPENDS_ON → `System`
- DEPENDS_ON → `System.Net.Http.Primitives`
- DEPENDS_ON → `System.Net.Http.WebRequest`

## Used by

2 references from 2 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Injected or called by (1)

- `Pams.API` — `Pams/API/Pams.API/Pams.API.csproj`:1

### Declared in (1)

- `Pams` — `Pams/Pams.sln`:1
