# SendGridMail

**Kind:** Service

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

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

NuGet package dependency

`SendGridMail` is a NuGet package dependency declared in `Pams.Core.csproj`. It provides email delivery capabilities to the Pams.Core layer through the SendGrid client library.

## Diagram

```mermaid
sequenceDiagram
    participant App as Application Code
    participant Core as Pams.Core
    participant SendGrid as SendGridMail Package
    participant API as SendGrid API

    App->>Core: Request email delivery
    Core->>SendGrid: Create and send message
    SendGrid->>API: Submit email request
    API-->>SendGrid: Return delivery response
    SendGrid-->>Core: Return result
    Core-->>App: Return send status
```

## Usage

```ts
import { MailService } from "@sendgrid/mail";

const mailService = new MailService();
mailService.setApiKey(process.env.SENDGRID_API_KEY!);

await mailService.send({
  to: "recipient@example.com",
  from: "sender@example.com",
  subject: "Pams notification",
  text: "Your request has been processed."
});
```

## AI Coding Instructions

- Keep SendGrid API keys in configuration or environment variables; do not hard-code them in source files.
- Create email messages in the application layer, then pass them to the SendGrid client for delivery.
- Handle SendGrid send failures and record the returned error details for diagnostics.
- Confirm the configured sender address is verified in the SendGrid account.
- Keep the `SendGridMail` package reference compatible with the target framework in `Pams.Core.csproj`.

## Used by

1 reference from 1 file. 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.Core` — `Pams/Core/Pams.Core/Pams.Core.csproj`:1
