> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ycloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# email.delivery.updated

> 当邮件发送状态更新，且状态变更为 `delivered` 或 `failed` 时触发。

在您的 Webhook 端点中使用 `email.delivery.updated` 来处理此事件。

## 触发条件

当邮件发送状态更新，且状态变更为 `delivered` 或 `failed` 时触发。

在您[配置 Webhook 端点](https://docs.ycloud.com/zh/api-reference/guides/api-fundamentals/configure-webhooks.md)时订阅 `email.delivery.updated`。

## 语法

YCloud 会向您配置的 Webhook URL 发送 HTTP `POST` 请求。以下结构展示了一种有效载荷变体。尖括号中的值为占位符；其类型列在 **参数** 下。可选字段和其他变体如下所述。

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "<ID>",
  "type": "email.delivery.updated",
  "apiVersion": "<API_VERSION>",
  "createTime": "<CREATE_TIME>",
  "emailDelivery": {
    "emailId": "<EMAIL_ID>",
    "recipientAddress": "<RECIPIENT_ADDRESS>",
    "status": "<STATUS>",
    "externalId": "<EXTERNAL_ID>"
  }
}
```

## 参数

在处理 JSON 请求体之前验证 `YCloud-Signature` HTTP 请求头。参见[签名验证](https://docs.ycloud.com/zh/api-reference/guides/api-fundamentals/configure-webhooks.md)。

### 事件外层封装

| 参数 | 类型 | 是否必填 | 描述 |
| - | - | - | - |
| `id` | string | 是 | 事件的唯一 ID。最小长度：`6`。最大长度：`128`。 |
| `type` | string | 是 | 固定为 `email.delivery.updated`。 |
| `apiVersion` | string | 是 | 用于呈现此事件的 API 版本。 |
| `createTime` | string (date-time) | 是 | 该事件的创建时间，格式为 [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339)。例如：`2022-06-01T12:00:00.000Z`。 |

### 事件有效载荷

| 参数 | 类型 | 是否必填 | 描述 |
| - | - | - | - |
| `emailDelivery` | object | 否 | 特定事件的 `emailDelivery` 有效载荷。 |

四个通用外层封装字段为必填项。有效载荷字段取决于事件变体。在每个对象表格中，当其父对象存在时， **必填** 适用。可选字段可以省略；示例并不代表该字段为必填项。

#### emailDelivery

| 参数 | 类型 | 是否必填 | 描述 |
| - | - | - | - |
| `emailId` | string | 是 | 您之前发送的相关邮件的唯一 ID。最小长度：`6`。最大长度：`128`。 |
| `recipientAddress` | string | 是 | 收件人的电子邮箱地址。 |
| `status` | string | 否 | 邮件发送到特定收件人地址的送达状态。<ul><li>`sending`：发送请求已由我们的系统接受。</li><li>`failed`：消息未能从我们的系统发送。</li><li>`sent`：消息已从我们的系统发出。</li><li>`delivered`：我们的系统已收到送达回执，表明消息已送达。</li><li>`undelivered`：我们的系统已收到送达回执，表明消息未送达。</li></ul> |
| `errorCode` | string | 否 | 邮件无法送达时的错误代码。 |
| `errorMessage` | string | 否 | 邮件无法送达时的错误消息。 |
| `externalId` | string | 否 | 您在发送邮件时设置的 `externalId`。 |
| `bizType` | string | 否 | 可以为空，或者为 `email`、`verify` 之一。默认为 `email`。<ul><li>`email`：表示该消息是通过 **Email** 产品发送的。</li><li>`verify`：表示该消息是通过 **Verify** 产品发送的。</li></ul> |
| `verificationId` | string | 否 | 验证 ID。仅当 `bizType` 为 `verify` 时包含。 |

## 示例

以下 JSON 是传递给您的接收端的请求体。ID、电话号码和其他账户值仅供说明。

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "evt_example_email_delivery_updated",
  "type": "email.delivery.updated",
  "apiVersion": "v2",
  "createTime": "2026-05-26T12:00:00.000Z",
  "emailDelivery": {
    "emailId": "email_12345678",
    "recipientAddress": "recipient@example.com",
    "status": "delivered",
    "externalId": "order_123"
  }
}
```

验证签名并持久接收该事件后，返回 `2xx` 响应。耗时任务请以异步方式处理。

```http theme={"theme":{"light":"github-light","dark":"github-dark"}}
HTTP/1.1 200 OK
```

有关场景演练，请参阅[带注释的示例](https://docs.ycloud.com/zh/api-reference/guides/examples/webhook-examples/whatsapp-message-updated-webhook-examples)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.