# Sent Mail Inspection

<a id="get-api-v1-mail-sent"></a>
#### `GET /api/v1/mail-sent`

*List sent-mail delivery records*

Parse the Postfix mail log and return per-message delivery records, with optional sender/recipient/status/domain filters.

**Query parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `lines` | integer | no | minimum=100; maximum=50000 |
| `sender` | string | no | — |
| `recipient` | string | no | — |
| `status` | string | no | — |
| `domain` | string | no | — |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_list_SentRecord__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": [
    {
      "component": "...",
      "delay": "...",
      "dsn": "...",
      "queue_id": "...",
      "recipient": "...",
      "relay": "...",
      "sender": "...",
      "size": "...",
      "status": "...",
      "status_detail": "...",
      "timestamp": "..."
    }
  ],
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/mail-sent
```

---

<a id="get-api-v1-mail-sent-domain-summary"></a>
#### `GET /api/v1/mail-sent/domain-summary`

*Per-domain sent-mail summary*

Aggregate delivery records by sender domain and user (cPanel-style mail report).

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_list_DomainSummary__` | Successful Response |

**Response example (200):**

```json
{
  "data": [
    {
      "data_sent": "...",
      "deferrals": "...",
      "domain": "...",
      "failed_and_deferred": "...",
      "failures": "...",
      "sent": "...",
      "total_messages": "...",
      "user": "..."
    }
  ],
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/mail-sent/domain-summary
```

---

<a id="get-api-v1-mail-sent-stats"></a>
#### `GET /api/v1/mail-sent/stats`

*Sent-mail aggregate statistics*

Return aggregate delivery counters (sent/deferred/bounced/rejected, unique senders/recipients, total size) from the mail log.

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_SentStats_` | Successful Response |

**Response example (200):**

```json
{
  "data": {
    "bounced": 0,
    "deferred": 0,
    "other": 0,
    "rejected": 0,
    "sent": 0,
    "total": 0,
    "total_size": 0,
    "unique_recipients": 0,
    "unique_senders": 0
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/mail-sent/stats
```

---
