> For the complete documentation index, see [llms.txt](https://resources.atriptech.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://resources.atriptech.com/api-wen-dang/readme/webhook-gai-lan/email-notification.md).

# 邮件通知

{% hint style="info" %}
遇到 API 接入问题时，可登录 [Eva](https://www.atriptech.com/) 寻求帮助。
{% endhint %}

当你需要处理与订单相关的航司邮件时，使用这个 webhook。

### 触发时机

当 Atlas 邮件捕获服务收到与订单相关的航司邮件时，会发送 `email.all`。

### 收到后建议处理

收到事件后，建议：

* 保存 `orderNo` 和 `uniqueCode`
* 按 `emailCategory` 对邮件分类
* 如果需要完整正文，尽快拉取或归档邮件内容
* 按需流转到客服、航变或预订后流程

### 推送方式

Atlas 会向你已注册的 webhook 地址发起 `POST` 请求。

### 建议优先读取的字段

* `type`
* `data.orderNo`
* `data.emailCategory`
* `data.emailSubject`
* `data.emailLink`
* `data.createTime`

### 典型载荷

```json
{
  "cid": "XXXXX",
  "data": {
    "orderNo": "XXXXXX",
    "emailCategory": "Payment Success",
    "emailSubject": "easyJet booking reference: XXXXX",
    "emailLink": "http://example.com/email.eml",
    "createTime": "2024-01-05 10:54:26"
  },
  "notificationId": "20240105105430470MJMOR",
  "status": -1,
  "type": "email.all"
}
```

### 说明

* `emailLink` 是临时链接，很快会失效
* 如果需要长期保留，请自行存储邮件内容
* `status` 是内部字段，不要用于业务判断

{% tabs %}
{% tab title="字段说明" %}
**`cid`**

* **类型：** String
* **是否必填：** 是
* **说明：** 客户唯一标识。
* **默认值：** 无
* **示例：** `"XXXXX"`

**`notificationId`**

* **类型：** String
* **是否必填：** 是
* **说明：** 通知事件唯一标识。
* **默认值：** 无
* **示例：** `"20240105105430470MJMOR"`

**`status`**

* **类型：** Integer
* **是否必填：** 是
* **说明：** 此类通知里通常固定为 `-1`。属于内部字段，可忽略。
* **默认值：** 无
* **示例：** `-1`

**`type`**

* **类型：** String
* **是否必填：** 是
* **说明：** 通知类型。
* **默认值：** 无
* **示例：** `"email.all"`

**`data`**

* **类型：** Object
* **是否必填：** 是
* **说明：** 包含邮件相关信息。
* **默认值：** 无
* **示例：** `{ ... }`

**`data.orderNo`**

* **类型：** String
* **是否必填：** 是
* **说明：** 邮件关联的订单号。
* **默认值：** 无
* **示例：** `"XXXXXX"`

**`data.emailReceivingDate`**

* **类型：** String
* **是否必填：** 是
* **说明：** Atlas 收到邮件的时间，UTC，格式为 `YYYY-MM-DD HH:mm:ss`。
* **默认值：** 无
* **示例：** `"2024-01-05 10:54:21"`

**`data.uniqueCode`**

* **类型：** String
* **是否必填：** 是
* **说明：** 邮件唯一标识码。
* **默认值：** 无
* **示例：** `"e4afbecfd5727817ff73a71a94a2a64d"`

**`data.emailCategory`**

* **类型：** String
* **是否必填：** 是
* **说明：** Atlas 归类的邮件类型。分类结果仅供参考，不保证绝对准确。
* **可选值：**
  * Schedule change
  * Receipt
  * Payment Success
  * Verification
  * Trip Reminder
  * Promo code
  * Travel Itinerary
  * Advertisement
  * PNR Cancellation Success
  * Payment Due
  * Unidentified
  * Duplicated Schedule Change
  * Unaccounted Cancellation
* **默认值：** 无
* **示例：** `"Payment Success"`

**`data.from`**

* **类型：** String
* **是否必填：** 是
* **说明：** 发件人邮箱地址。
* **默认值：** 无
* **示例：** `"donotreply@easyjet.com"`

**`data.to`**

* **类型：** String
* **是否必填：** 是
* **说明：** 收件人邮箱地址。
* **默认值：** 无
* **示例：** `"NSDLZCQTGJTEYXOMFOD@gorn.top"`

**`data.emailSubject`**

* **类型：** String
* **是否必填：** 是
* **说明：** 邮件主题。
* **默认值：** 无
* **示例：** `"easyJet booking reference: XXXXX"`

**`data.emailLink`**

* **类型：** String
* **是否必填：** 是
* **说明：** 邮件正文访问链接。该链接通常只在 10 分钟内有效。
* **默认值：** 无
* **示例：** `"http://order-oss-sg.oss-ap-southeast-1.aliyuncs.com/...eml?Expires=1704426870..."`

**`data.createTime`**

* **类型：** String
* **是否必填：** 是
* **说明：** Atlas 在邮件列表中创建该记录的时间。通常晚于接收时间。格式为 `YYYY-MM-DD HH:mm:ss`。
* **默认值：** 无
* **示例：** `"2024-01-05 10:54:26"`
  {% endtab %}

{% tab title="示例" %}

```json
{
    "cid":"XXXXX",
    "data":{
        "orderNo":"XXXXXX",
        "emailReceivingDate":"2024-01-05 10:54:21",
        "uniqueCode":"e4afbecfd5727817ff73a71a94a2a64d",
        "emailCategory":"Payment Success",
        "from":"donotreply@easyjet.com",
        "to":"NSDLZCQTGJTEYXOMFOD@gorn.top",
        "emailSubject":"easyJet booking reference: XXXXX",
        "emailLink":"http://order-oss-sg.oss-ap-southeast-1.aliyuncs.com/2024/01/e4afbecfd5727817ff73a71a94a2a64d.eml?Expires=1704426870&OSSAccessKeyId=LTAI5tDmTE9iwtNdsqxVXuom&Signature=zF8aNNsGgY8n2jhsW7V1gmPLw8c%3D",
        "createTime":"2024-01-05 10:54:26"
    },
    "notificationId":"20240105105430470MJMOR",
    "status":-1,
    "type":"email.all"
}
```

{% endtab %}
{% endtabs %}

### 相关页面

* [邮件查询](/api-wen-dang/readme/gong-ju-api-gai-lan/you-jian-cha-xun.md)
* [事件通知](/api-wen-dang/readme/webhook-gai-lan/incident-notification.md)
* [Webhook 概览](/api-wen-dang/readme/webhook-gai-lan.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://resources.atriptech.com/api-wen-dang/readme/webhook-gai-lan/email-notification.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
