

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 使用 Amazon SES 事件发布监控电子邮件发送
<a name="monitor-using-event-publishing"></a>

为了使您能够精细地跟踪电子邮件的发送，您可以将 Amazon SES 设置为根据您定义的特征向亚马逊、Amazon Data Firehose CloudWatch、Amazon Pinpoint、亚马逊简单通知服务或 EventBridge 亚马逊发布*电子邮件发送事件*。

您可以跟踪多种类型的电子邮件发送事件，包括发送、送达、打开、点击、退回、投诉、拒绝、呈现失败和送达延迟。此信息可用于操作和分析目的。例如，您可以将电子邮件发送数据发布到 CloudWatch 并创建控制面板来跟踪电子邮件活动的效果，也可以使用 Amazon SNS 在某些事件发生时向您发送通知。

## 事件发布如何与配置集和消息标签协同工作
<a name="event-publishing-how-works"></a>

要使用事件发布，您首先要设置一个或多个*配置集*。配置集用于指定发布事件的位置和要发布的事件。然后，每次发送电子邮件时，都要提供配置集的名称和一个或多个 name/value 成对的*邮件标签*，以对电子邮件进行分类。例如，如果您要宣传书籍，则当您为关联的营销活动发送电子邮件时，可以将邮件标签命名为 *genre*，并指定值 *sci-fi* 或 *western*。

根据您使用的电子邮件发送接口，您可以将消息标签作为参数提供给 [https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_SendEmail.html](https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_SendEmail.html) API 操作的 [https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_SendEmail.html#SES-SendEmail-request-EmailTags](https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_SendEmail.html#SES-SendEmail-request-EmailTags) 字段，或者将消息标签添加到 SES 特定的电子邮件头 [https://docs.aws.amazon.com/ses/latest/dg/event-publishing-send-email.html#event-publishing-using-ses-headers](https://docs.aws.amazon.com/ses/latest/dg/event-publishing-send-email.html#event-publishing-using-ses-headers)。有关配置集的更多信息，请参阅[在 SES 中使用配置集](using-configuration-sets.md)。

除了您指定的消息标签之外，SES 还会将*自动标签*添加到您发送的消息。您无需执行任何其他步骤就能使用自动标签。

下表列出了自动应用于您使用 SES 发送的消息的自动标签。


**SES 自动标签**  

| 自动标签名称 | 说明 | 
| --- | --- | 
| ses:caller-identity | 发送电子邮件的 SES 用户的 IAM 身份。 | 
| ses:configuration-set | 与电子邮件关联的配置集的名称。 | 
| ses:from-domain | “发件人”地址的域。 | 
| ses:outgoing-ip | SES 用来发送电子邮件的 IP 地址。 | 
| ses:source-ip | 发起人用来发送电子邮件的 IP 地址。 | 
| ses:source-tls-version | 调用方用来发送电子邮件的 TLS 协议版本。 | 
| ses:outgoing-tls-version | SES 用来发送电子邮件的 TLS 协议版本。 | 

## 电子邮件营销活动的细粒度反馈
<a name="event-publishing-fine-grained-feedback"></a>

`ses:feedback-id-<a or b>` 标签是一个可选的消息标签，您可以将其视为混合或半自动标签，虽然它与上一节中讨论的自动标签类似，但不同之处在于，您必须手动添加它并使用 `ses:` 前缀键。您最多可以使用两个这样的标签，分别定义 `ses:feedback-id-a` 和 `ses:feedback-id-b`。

当您指定这些标签时，SES 会自动将它们附加到标准 `Feedback-ID` 标头中，这些标头用于在反馈循环（FBL）中提供传送统计信息，例如投诉率和垃圾邮件率，请参阅[反馈循环](faqs-enforcement.md#cm-feedback-loop)。标`Feedback-ID`题由 SES 用于收集投诉信息的标识符 *SESInternalID* 和标识 SES 为发送平台的静态标签 *Amazon* SES 组成，例如：

`FeedBackId:feedback-id-a:feedback-id-b:((SESInternalID):(AmazonSES))`

这些可选的反馈 ID 标签为您提供了一种生成细粒度反馈的方式，例如，针对您作为电子邮件营销活动一部分发送的邮件。您可以通过在 [https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_SendEmail.html](https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_SendEmail.html) 操作请求的 [https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_SendEmail.html#SES-SendEmail-request-EmailTags](https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_SendEmail.html#SES-SendEmail-request-EmailTags) 字段中将其指定为消息标签来使用 `ses:feedback-id-<a or b>`，如以下示例所示：

```
{
  "FromEmailAddress": "noreply@example.com",
  "Destination": {
    "ToAddresses": [
      "customer@example.net"
    ]
  },
  "Content": {
    "Simple": {
      "Subject": {
        "Data": "Hello and welcome"
      },
      "Body": {
        "Text": {
          "Data": "Lorem ipsum dolor sit amet."
        },
        "Html": {
          "Data": "Lorem ipsum dolor sit amet."
        }
      }
    }
  },
  "EmailTags": [
    {
      "Name": "ses:feedback-id-a",
      "Value": "new-members-campaign"
    },
    {
      "Name": "ses:feedback-id-b",
      "Value": "football-campaign"
    }
  ],
  "ConfigurationSetName": "football-club"
}
```

如果以原始格式发送，则可以将其 `ses:feedback-id-<a or b>` 作为消息标签添加到特定于 SES 的标头 [`X-SES-MESSAGE-TAGS`](event-publishing-send-email.md#event-publishing-using-ses-headers) 中。

也可以在亚马逊 CloudWatch 中跟踪`ses:feedback-id-<a or b>`消息标签，方法是将其指定为 CloudWatch 价值来源，就像任何其他消息标签一样，请参阅 [添加 CloudWatch 活动目的地](event-publishing-add-event-destination-cloudwatch.md#event-publishing-add-event-destination-cloudwatch-add)*（需支付额外费用，参见[每个指标的价格 CloudWatch](event-publishing-add-event-destination-cloudwatch.md#cw-add-pricing)。）*

## 如何使用事件发布
<a name="event-publishing-how-to-use"></a>

以下几节包含设置和使用 SES 事件发布所需的信息。
+ [设置事件发布](monitor-sending-using-event-publishing-setup.md)
+ [使用事件数据](working-with-event-data.md)

## 事件发布术语
<a name="event-publishing-terminology"></a>

以下列表定义了与 SES 事件发布相关的术语。

**电子邮件发送事件**  
与您提交到 SES 的电子邮件的结果关联的信息。发送事件包括：  
+ **Send**（发送）– 发送请求成功，Amazon SES 将尝试将邮件发送到收件人的邮件服务器。（如果使用账户级别或全局抑制，SES 仍会将其计为发送，但会抑制送达。）
+ **RenderingFailure**— 由于模板渲染问题，电子邮件未发送。当模板数据丢失或模板参数与数据不匹配时，可能会发生此事件类型。（此事件类型仅在您使用 [https://docs.aws.amazon.com/ses/latest/APIReference/API_SendTemplatedEmail.html](https://docs.aws.amazon.com/ses/latest/APIReference/API_SendTemplatedEmail.html) 或 [https://docs.aws.amazon.com/ses/latest/APIReference/API_SendBulkTemplatedEmail.html](https://docs.aws.amazon.com/ses/latest/APIReference/API_SendBulkTemplatedEmail.html) API 操作发送电子邮件时发生。）
+ **Reject**（拒绝）– Amazon SES 已接受电子邮件，但确定它包含病毒，而未尝试将其发送到收件人的邮件服务器。
+ **Delivery**（送达）– Amazon SES 成功将电子邮件发送到收件人的邮件服务器。
+ **退信** – 收件人的邮件服务器永久拒绝了电子邮件的*硬退信*。（仅当 S *ES 不再尝试发送电子邮件时，才会包含软退件*。 通常，这些软退件表示投递失败，尽管在某些情况下，即使邮件成功到达收件人收件箱，也可以返回软退件。 当收件人发送 out-of-office自动回复时，通常会发生这种情况。 在这篇 re [AWS : Post 文章](https://repost.aws/knowledge-center/ses-understand-soft-bounces)中了解有关软反弹的更多信息。）
+ **Complaint**（投诉）– 电子邮件已成功送达收件人的邮件服务器，但收件人将其标记为垃圾邮件。
+ **DeliveryDelay**— 由于出现临时问题，无法将电子邮件发送到收件人的邮件服务器。例如，当收件人的收件箱已满，或者当接收电子邮件服务器遇到临时问题时，可能会发生传送延迟。
+ **Subscription**（订阅）– 电子邮件已成功发送，但收件人通过单击电子邮件标头中的 `List-Unsubscribe` 或脚注中的 `Unsubscribe` 链接更新了订阅首选项。
+ **Open**（打开）– 收件人已收到邮件并在其电子邮件客户端中打开了邮件。
+ **Click**（单击）– 收件人单击了电子邮件中包含的一个或多个链接。

**配置集**  
一组规则，用于定义 SES 将电子邮件发送事件发布到的目标，以及要发布的电子邮件发送事件的类型。在发送您希望用于事件发布的电子邮件时，您将指定与电子邮件关联的配置集。

**事件目标**  
您向其发布 SES 电子邮件发送事件的 AWS 服务。您设置的每个事件目标都属于一个（且仅属于一个）配置集。

**邮件标签**  
用于 name/value 对电子邮件进行分类以进行活动发布的配对。示例包括*营销活动/书籍* 和*营销活动/服装*。在发送电子邮件时，您可以将邮件标签指定为 API 调用的参数，或指定为特定于 SES 的电子邮件标头。

**自动标签**  
自动包含在事件发布报告中的邮件标签。有一个用于配置集名称、“发件人”地址的域、发起人的出站 IP 地址、SES 出站 IP 地址和发起人的 IAM 身份的自动标签。

# 设置 Amazon SES 事件发布
<a name="monitor-sending-using-event-publishing-setup"></a>

本节介绍配置 Amazon SES 以将您的电子邮件发送事件发布到以下 AWS 服务所需的操作：
+ Amazon CloudWatch
+ Amazon Data Firehose
+ Amazon Pinpoint
+ Amazon Simple Notiﬁcation Service（Amazon SNS）

以下主题介绍了设置事件发布所需的以下步骤：

1. 必须使用 Amazon SES 控制台或 API 创建一个*配置集*。

1. 将一个或多个*事件目标*（Firehose CloudWatch、Pinpoint 或 SNS）添加到配置集，并配置事件目标的唯一参数。

1. 在发送电子邮件时，指定要使用的包含事件目标的配置集。

**Topics**
+ [

# 步骤 1：创建配置集
](event-publishing-create-configuration-set.md)
+ [

# 步骤 2：添加事件目标
](event-publishing-add-event-destination.md)
+ [

# 步骤 3：在发送电子邮件时指定配置集
](event-publishing-send-email.md)

# 步骤 1：创建配置集
<a name="event-publishing-create-configuration-set"></a>

必须首先具有配置集以设置事件发布。如果您还没有配置集，或者希望创建新配置集，请参阅 [在 SES 中创建配置集](creating-configuration-sets.md)

您也可以使用 Amazon SES API V2 或 Amazon SES CLI v2 中的[CreateConfigurationSet](https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_CreateConfigurationSet.html)操作创建配置集，请参阅。[创建一个配置集 (AWS CLI)](creating-configuration-sets.md#config-sets-create-cli)

# 步骤 2：添加事件目标
<a name="event-publishing-add-event-destination"></a>

事件目标是将 Amazon SES 事件发布到的位置。您设置的每个事件目标都属于一个（且仅属于一个）配置集。使用 Amazon SES 设置活动目的地时，您可以选择 AWS 服务目的地，然后指定与该目的地关联的参数。

设置活动目的地时，可以选择将事件发送到以下 AWS 服务之一：
+ Amazon CloudWatch
+ Amazon Data Firehose
+ Amazon EventBridge
+ Amazon Pinpoint
+ Amazon Simple Notiﬁcation Service（Amazon SNS）

您选择的事件目标取决于您所需的事件详细级别，以及您所需的接收事件信息的方式。如果您只想了解每一类事件的运行总数（例如，为了可以设置在总数过高时发出警报），可以使用 CloudWatch。

如果您想将详细的事件记录输出到其他服务（例如亚马逊 OpenSearch 服务或亚马逊 Redshift）进行分析，则可以使用 Firehose。

如果您想要在某些事件发生时接收通知，可以使用 Amazon SNS。

**Topics**
+ [

# 为 CloudWatch 活动发布设置活动目的地
](event-publishing-add-event-destination-cloudwatch.md)
+ [

# 为 Amazon SES 事件发布设置 Data Firehose 事件目标
](event-publishing-add-event-destination-firehose.md)
+ [

# 为活动发布设置一个 Amazon EventBridge 目的地
](event-publishing-add-event-destination-eventbridge.md)
+ [

# 针对事件发布设置 Amazon Pinpoint 事件目标
](event-publishing-add-event-destination-pinpoint.md)
+ [

# 针对事件发布设置 Amazon SNS 事件目标
](event-publishing-add-event-destination-sns.md)

# 为 CloudWatch 活动发布设置活动目的地
<a name="event-publishing-add-event-destination-cloudwatch"></a>

借助[亚马逊 CloudWatch 指标](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/working_with_metrics.html)，您可以使用事件目标发布向发送事件的 Amazon SES 电子邮件 CloudWatch。由于只能在配置集中设置 CloudWatch 事件目的地，因此必须先[创建配置集](event-publishing-create-configuration-set.md)，然后将事件目标添加到配置集中。

将 CloudWatch 事件目标添加到配置集时，必须选择一个或多个与发送电子邮件时使用的消息标签相对应的 CloudWatch *维度*。与消息标签一样， CloudWatch 维度是帮助您唯一标识指标的 name/value 配对。

例如，您可以有名为 `campaign` 的一个邮件标签和一个维度，用于标识您的电子邮件营销活动。当您将电子邮件发送事件发布到时 CloudWatch，选择消息标签和维度非常重要，因为这些选择会影响您的 CloudWatch 账单，并决定如何筛选电子邮件发送事件数据 CloudWatch。

本节提供的信息可帮助您选择维度，然后说明如何向配置集添加 CloudWatch 事件目的地。

**Topics**
+ [

## 添加 CloudWatch 活动目的地
](#event-publishing-add-event-destination-cloudwatch-add)
+ [

## 选择 CloudWatch 尺寸
](#event-publishing-add-event-destination-cloudwatch-dimensions)

## 添加 CloudWatch 活动目的地
<a name="event-publishing-add-event-destination-cloudwatch-add"></a>

本节中的过程说明如何将 CloudWatch 事件目标详细信息添加到配置集中，并假设您已经完成了中的步骤 1 到步骤 6 [创建事件目标](event-destinations-manage.md#event-destination-add)。

您还可以使用 Amazon SES API V2 中的[UpdateConfigurationSetEventDestination](https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_UpdateConfigurationSetEventDestination.html)操作来创建和修改事件目的地。

**使用控制台向配置集添加 CloudWatch 事件目标详细信息**

1. 以下是在[步骤 7](event-destinations-manage.md#specify-event-dest-step) 中选择 CloudWatch 活动目的地类型的详细说明，并假设您已完成中之前的所有步骤[创建事件目标](event-destinations-manage.md#event-destination-add)。选择 CloudWatch **目标类型、输入目标****名称**并启用**事件发布**后，将显示 **Amazon CloudWatch 维度**窗格，其字段将在以下步骤中进行处理。*（需支付额外费用，请参阅[每个指标的价格 CloudWatch](#cw-add-pricing)。）* 

1. 对于**值来源**，指定 Amazon SES 将如何获取其传递到的数据 CloudWatch。提供了以下值来源：
   + **邮件标签**：Amazon SES 从使用 `X-SES-MESSAGE-TAGS` 标头或 `EmailTags` API 参数指定的标签中检索维度名称和值。有关使用邮件标签的更多信息，请参阅 [步骤 3：在发送电子邮件时指定配置集](event-publishing-send-email.md)。
**注意**  
邮件标签可以包含数字 0-9、字母 A-Z（大写和小写字母）、连字符（-）和下划线（\$1）。

     您也可以使用 **Message Tag (邮件标签)** 值来源根据 Amazon SES 自动标签创建维度。要使用自动标签，请键入自动标签的完整名称以作为 **Dimension Name (维度名称)**。例如，要根据配置集自动标签创建维度，请将 `ses:configuration-set` 作为 **Dimension Name (维度名称)** 并将配置集的名称作为 **Default Value (默认值)**。有关完整的自动标签列表，请参阅 [事件发布如何与配置集和消息标签协同工作](monitor-using-event-publishing.md#event-publishing-how-works)。
   + **Email Header (电子邮件标头)**：Amazon SES 从电子邮件中的标头检索维度名称和值。
**注意**  
您不能使用以下任意电子邮件标头作为 **Dimension Name (维度名称)**：`Received`、`To`、`From`、`DKIM-Signature`、`CC`、`message-id` 或 `Return-Path`。
   + **Link Tag (链接标签)**：Amazon SES 从您在链接中指定的标签检索维度名称和值。有关向链接添加标签的更多信息，请参阅 [我能否用唯一标识符来标记链接？](faqs-metrics.md#sending-metric-faqs-clicks-q5)。

1. 对于 **Dimension Name (维度名称)**，请键入要传递到 CloudWatch 的维度的名称。
**注意**  
维度名称只能包含 ASCII 字母 (a-z , A-Z )、数字 (0 - 9 )、下划线 (\$1) 和dashes (-)。不允许使用空格、重音字符、非拉丁字符和其他特殊字符。

1. 对于 **Default Value**（默认值），请键入维度的值。
**注意**  
维度值只能包含 ASCII 字母（a-z、A-Z）、数字 (0-9)、下划线 (\$1)、短划线 (-)、@ 符号和句点 (.)。不允许使用空格、重音字符、非拉丁字符和其他特殊字符。

1. 如果要添加更多维度，请选择 **Add Dimension**（添加维度）。否则，请选择 **Next**（下一步）。

1. 在审核屏幕上，如果您对定义事件目标的方式感到满意，请选择**添加目标**。

## 选择 CloudWatch 尺寸
<a name="event-publishing-add-event-destination-cloudwatch-dimensions"></a>

选择用作 CloudWatch 维度的名称和值时，请考虑以下因素：
+ **每个指标的价格** — 您可以免费查看基本的 Amazon SES 指标。 CloudWatch 但是，当您使用事件发布收集指标时，会产生[CloudWatch 详细监控](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch-metrics-basic-detailed.html)费用。事件类型、维度名称和维度值的每个唯一组合都会在中创建不同的指标 CloudWatch。当您使用 CloudWatch “详细监控” 时，您需要为每个指标付费。出于此原因，您可能想要避免选择需要许多不同值的维度。例如，除非对通过“发件人”域跟踪电子邮件发送事件非常感兴趣，否则可能不希望为 Amazon SES 自动标签 `ses:from-domain` 定义维度，因为它可能需要许多不同的值。有关更多信息，请参阅[CloudWatch 定价](https://aws.amazon.com/cloudwatch/pricing)。
+ **指标筛选**-如果一个指标有多个维度，则无法 CloudWatch 根据每个维度分别访问该指标。出于这个原因，在为单个 CloudWatch 活动目的地添加多个维度之前，请仔细考虑。例如，如果要按 `campaign` 或 `campaign` 和 `genre` 组合查看指标，您需要添加两个事件目标：一个目标仅将 `campaign` 作为维度，另一个目标将 `campaign` 和 `genre` 作为维度。
+ **维度值来源**：除了使用特定于 Amazon SES 的标头或 API 的参数指定维度值之外，您还可以选择让 Amazon SES 从您自己的 MIME 消息标头中获取维度值。如果您已在使用自定义标头并且不想更改电子邮件或对电子邮件发送 API 的调用以根据标头值收集指标，则可以使用此选项。如果对 Amazon SES 事件发布使用自己的 MIME 邮件标头，则用于 Amazon SES 事件发布的标头名称和值只能包含字母 A-Z、数字 0-9、下划线 (\$1)、at 符号 (@)、连字符 (-) 和句点 (.)。如果您指定的名称或值包含其他字符，则发送电子邮件的呼叫仍将成功，但不会将事件指标发送到 Amazon CloudWatch。

有关 CloudWatch 概念的更多信息，请参阅[亚马逊* CloudWatch 用户指南中的亚马逊 CloudWatch *概念](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html)。

# 为 Amazon SES 事件发布设置 Data Firehose 事件目标
<a name="event-publishing-add-event-destination-firehose"></a>

Amazon Data Firehose 事件目标代表将特定的 Amazon SES 电子邮件发送事件发布到 Firehose 的实体。由于 Firehose 事件目标只能在配置集中设置，因此首先必须[创建配置集](event-publishing-create-configuration-set.md)。接下来，将事件目标添加到配置集中。

本节中的过程演示如何将 Firehose 事件目标详细信息添加到配置集，并假设您已完成 [创建事件目标](event-destinations-manage.md#event-destination-add) 中的步骤 1 到 6。

您还可以使用 Amazon SES API V2 目标中的[UpdateConfigurationSetEventDestination](https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_UpdateConfigurationSetEventDestination.html)操作来创建和更新事件目标。

**使用控制台将 Firehose 事件目标详细信息添加到配置集**

1. 以下是[步骤 7](event-destinations-manage.md#specify-event-dest-step) 中选择 Firehose 作为事件目标类型的详细说明，并假设您已完成[创建事件目标](event-destinations-manage.md#event-destination-add)中的所有之前的步骤。在选择 Firehose **目标类型**，输入目标**名称**并启用**事件发布**后，**Amazon Data Firehose 传输留**窗格将显示，其字段将在以下步骤中得到处理。

1. 对于**传输流**，请选择现有的 Firehose 传输流，或选择**创建新流**以使用 Firehose 控制台创建新的传输流。

   有关使用 Firehose 控制台创建流的信息，请参阅《Amazon Data Firehose 开发人员指南》**中的[创建 Amazon Kinesis Firehose 传输流](https://docs.aws.amazon.com/firehose/latest/dev/basic-create.html)。

1. 对于 **Identity and Access Management（IAM）角色**，请选择一个 Amazon SES 有权限代表您发布到 Firehose 的 IAM 角色。您可以选择现有角色，或者让 Amazon SES 为您创建一个角色，也可以创建自己的角色。

   如果您选择现有角色或创建自己的角色，您必须手动修改该角色的策略，授予该角色访问 Firehose 传输流的权限，并授予 Amazon SES 代入该角色的权限。有关示例策略，请参阅 [授予 Amazon SES 发布到 Firehose 传输流的权限](#event-publishing-add-event-destination-firehose-role)。

1. 选择**下一步**。

1. 在审核屏幕上，如果您对定义事件目标的方式感到满意，请选择**添加目标**。

有关如何使用 `UpdateConfigurationSetEventDestination` API 添加 Firehose 事件目标的信息，请参阅 [Amazon Simple Email Service API 参考](https://docs.aws.amazon.com/ses/latest/APIReference/API_UpdateConfigurationSetEventDestination.html)。

## 授予 Amazon SES 发布到 Firehose 传输流的权限
<a name="event-publishing-add-event-destination-firehose-role"></a>

要允许 Amazon SES 向您的 Firehose 传输流发布记录，您必须使用 AWS Identity and Access Management （IAM）[角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html)，并附加或修改该角色的权限策略和信任策略。权限策略允许该角色向您的 Firehose 传输流发布记录，信任策略允许 Amazon SES 代入该角色。

本部分提供有关两个策略的一些示例。有关向 IAM 角色添加策略的信息，请参阅《IAM 用户指南》**中的[修改角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_manage_modify.html)。

### 权限策略
<a name="event-publishing-add-event-destination-firehose-role-permission"></a>

以下权限策略允许角色发布数据记录到您的 Firehose 传输流。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "",
            "Effect": "Allow",
            "Action": [
                "firehose:PutRecordBatch"
            ],
            "Resource": [
                "arn:aws:firehose:us-east-1:111122223333:deliverystream/delivery-stream-name"
            ]
        }
    ]
}
```

------

对前面的策略示例进行以下更改：
+ *delivery-region*替换为您创建 Firehose 传送流的 AWS 区域。
+ 将 *111122223333* 替换为您的 AWS 账户 ID。
+ *delivery-stream-name*替换为 Firehose 传送流的名称。

### 信任策略
<a name="event-publishing-add-event-destination-firehose-role-trust"></a>

以下信任策略使 Amazon SES 能够代入该角色。

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "",
      "Effect": "Allow",
      "Principal": {
        "Service": "ses.amazonaws.com"
      },
      "Action": "sts:AssumeRole",
      "Condition": {
        "StringEquals": {
          "AWS:SourceAccount": "111122223333",
          "AWS:SourceArn": "arn:aws:ses:delivery-region:111122223333:configuration-set/configuration-set-name"
        }
      }
    }
  ]
}
```

------

对前面的策略示例进行以下更改：
+ *delivery-region*替换为您创建 Firehose 传送流的 AWS 区域。
+ 将 *111122223333* 替换为您的 AWS 账户 ID。
+ 替换为*configuration-set-name*与 Firehose 交付流关联的配置集的名称。

# 为活动发布设置一个 Amazon EventBridge 目的地
<a name="event-publishing-add-event-destination-eventbridge"></a>

Amazon EventBridge 事件目标会通知您有关您在配置集中指定的电子邮件发送事件。SES 生成电子邮件发送事件，并将您在创建事件目的地时定义的事件发送到 EventBridge 默认事件总线。[事件总线](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-bus.html)是接收事件并将其传送到多个目的地的路由器。您可以在中详细了解如何将电子邮件发送事件与 Amazon EventBridge 集成[使用 Amazon 监控 SES 事件 EventBridge](monitoring-eventbridge.md)。由于只能在配置集中设置 EventBridge事件目的地，因此必须先[创建配置集](event-publishing-create-configuration-set.md)，然后才能将事件目标添加到配置集中。

本节中的过程说明如何将 EventBridge 事件目标详细信息添加到配置集中，并假设您已经完成了中的步骤 1 到步骤 6 [创建事件目标](event-destinations-manage.md#event-destination-add)。

您还可以使用 Amazon SES API V2 中的[UpdateConfigurationSetEventDestination](https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_UpdateConfigurationSetEventDestination.html)操作来创建和修改事件目的地。

**使用控制台将 EventBridge 事件目标详细信息添加到配置集中**

1. 以下是在[步骤 7](event-destinations-manage.md#specify-event-dest-step) 中选择 EventBridge 活动目的地类型的详细说明，并假设您已完成中之前的所有步骤[创建事件目标](event-destinations-manage.md#event-destination-add)。选择*亚马逊 EventBridge***目标类型**、输入目标**名称**并启用**活动发布**后，将显示**亚马逊 EventBridge 事件总线**信息窗格。

1. 选择**下一步**。

1. 在审核屏幕上，如果您对定义事件目标的方式感到满意，请选择**添加目标**。这将打开活动目的地的摘要页面，成功横幅将确认您的活动目的地是否已成功创建或修改。

# 针对事件发布设置 Amazon Pinpoint 事件目标
<a name="event-publishing-add-event-destination-pinpoint"></a>

Amazon Pinpoint 事件目标会通知您有关您在配置集中指定的电子邮件发送事件。由于 Amazon Pinpoint 事件目标只能在配置集中设置，您必须先[创建配置集](event-publishing-create-configuration-set.md)，再将事件目标添加到该配置集。

本节中的过程演示如何将 Amazon Pinpoint 事件目标详细信息添加到配置集，并假设您已完成 [创建事件目标](event-destinations-manage.md#event-destination-add) 中的步骤 1 到 6。

您还可以使用 Amazon SES API V2 中的[UpdateConfigurationSetEventDestination](https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_UpdateConfigurationSetEventDestination.html)操作来创建和修改事件目标。

您在 Amazon Pinpoint 项目中配置的通道类型需要额外支付费用。有关更多信息，请参阅 [Amazon Pinpoint 定价](https://aws.amazon.com/pinpoint/pricing/)。

**使用控制台将 Amazon Pinpoint 事件目标详细信息添加到配置集**

1. 以下是[步骤 7](event-destinations-manage.md#specify-event-dest-step) 中选择 Amazon Pinpoint 作为事件目标类型的详细说明，并假设您已完成[创建事件目标](event-destinations-manage.md#event-destination-add)中所有之前的步骤。
**注意**  
Amazon Pinpoint 不支持 **Delivery delays**（送达延迟）或 **Subscriptions**（订阅）事件类型。

   在选择 Amazon Pinpoint **目标类型**，输入目标**名称**并启用**事件发布**后，**Amazon Pinpoint 项目详细信息**窗格将显示，其字段将在以下步骤中得到处理。

1. 对于 **Project**（项目），选择现有的 Amazon Pinpoint 项目，或者选择 **Create a new project in Amazon Pinpoint**（在 Amazon Pinpoint 中创建新项目）以创建新项目。

   有关创建项目的信息，请参阅*《Amazon Pinpoint 用户指南》*中的[创建项目](https://docs.aws.amazon.com/pinpoint/latest/userguide/gettingstarted-create-project.html)。

1. 选择**下一步**。

1. 在审核屏幕上，如果您对定义事件目标的方式感到满意，请选择**添加目标**。这将打开活动目的地的摘要页面，成功横幅将确认您的活动目的地是否已成功创建或修改。

# 针对事件发布设置 Amazon SNS 事件目标
<a name="event-publishing-add-event-destination-sns"></a>

Amazon SNS 事件目标会通知您有关您在配置集中指定的电子邮件发送事件。由于 Amazon SNS 事件目标只能在配置集中设置，您必须先[创建配置集](event-publishing-create-configuration-set.md)，再将事件目标添加到该配置集。

本节中的过程演示如何将 Amazon SNS 事件目标详细信息添加到配置集，并假设您已完成 [创建事件目标](event-destinations-manage.md#event-destination-add) 中的步骤 1 到 6。

您还可以使用 Amazon SES API V2 中的[UpdateConfigurationSetEventDestination](https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_UpdateConfigurationSetEventDestination.html)操作来创建和修改事件目的地。

**注意**  
也可以通过 Amazon SNS 为任何经过验证的发送身份设置有关退信、投诉和送达的反馈通知。有关更多信息，请参阅[为 Amazon SES 配置 Amazon SNS 通知](configure-sns-notifications.md)。

向订阅 Amazon SNS 主题的端点发送消息会产生额外费用。有关更多信息，请参阅 [Amazon SNS 定价](https://aws.amazon.com/sns/pricing/)。

**使用控制台将 Amazon SNS 事件目标详细信息添加到配置集**

1. 以下是[步骤 7](event-destinations-manage.md#specify-event-dest-step) 中选择 Amazon SNS 作为事件目标类型的详细说明，并假设您已完成[创建事件目标](event-destinations-manage.md#event-destination-add)中的所有之前的步骤。在选择 Amazon SNS **目标类型**，输入目标**名称**并启用**事件发布**后，**Amazon Simple Notification Service（SNS）主体**窗格将显示，其字段将在以下步骤中得到处理。

1. 对于 **SNS topic**（SNS 主题），选择现有的 Amazon SNS 主题，或选择 **Create SNS topic**（创建 SNS 主题）以创建一个新主题。

   有关创建主题的信息，请参阅*《Amazon Simple Notification Service 开发人员指南》*中的[创建主题](https://docs.aws.amazon.com/sns/latest/dg/CreateTopic.html)。
**重要**  
当您使用 Amazon SNS 创建主题时，对于 **Type (类型)**，仅选择 **Standard (标准)**。（SES 不支持 FIFO 类型主题。）

1. 选择**下一步**。

1. 在审核屏幕上，如果您对定义事件目标的方式感到满意，请选择**添加目标**。这将打开活动目的地的摘要页面，成功横幅将确认您的活动目的地是否已成功创建或修改。

1. 无论是创建新的 SNS 主题还是选择现有主题，都需要授予 SES 访问权限，才能向该主题发布通知。在上一步的事件目标的摘要页面中，从 **Destination type**（目标类型）列中选择 **Amazon SNS** - 这将转到 Amazon Simple Notification Service 控制台中的 **Topics**（主题）列表 - *从 Amazon SNS 控制台执行以下步骤：*

   1. 选择您在上一步中创建或修改的 SNS 主题的名称。

   1. 在主题的详细信息屏幕上，选择**编辑**。

   1. 要授予 SES 发布主题通知的权限，请在 SNS 控制台的**编辑主题**屏幕上，展开**访问策略**，并在 **JSON 编辑器**中，添加以下权限策略：

------
#### [ JSON ]

****  

      ```
      {
          "Version":"2012-10-17",		 	 	 
          "Id": "notification-policy",
          "Statement": [
              {
                  "Effect": "Allow",
                  "Principal": {
                      "Service": "ses.amazonaws.com"
                  },
                  "Action": "sns:Publish",
                  "Resource": "arn:aws:sns:us-east-1:111122223333:topic_name",
                  "Condition": {
                      "StringEquals": {
                          "AWS:SourceAccount": "111122223333",
                          "AWS:SourceArn": "arn:aws:ses:topic_region:111122223333:configuration-set/configuration-set-name"
                      }
                  }
              }
          ]
      }
      ```

------

      对前面的策略示例进行以下更改：
      + *topic\$1region*替换为您创建 SNS 主题的 AWS 区域。
      + *111122223333*替换为您的 AWS 账户 ID。
      + *topic\$1name*替换为您的 SNS 主题的名称。
      + 替换为*configuration-set-name*与 SNS 事件目标关联的配置集的名称。

   1. 选择**保存更改**。

# 步骤 3：在发送电子邮件时指定配置集
<a name="event-publishing-send-email"></a>

在[创建配置集](event-publishing-create-configuration-set.md)和[添加事件目标](event-publishing-add-event-destination.md)后，事件发布的最后一步是发送您的电子邮件。

要发布与电子邮件相关联的事件，您必须提供配置集名称以便与电子邮件相关联。您还可以选择性地提供邮件标签以对电子邮件进行分类。

您可以以电子邮件发送 API 的参数、特定于 Amazon SES 的电子邮件标头或 MIME 邮件中的自定义标头的形式向 Amazon SES 提供这些信息。您选择的方法取决于所使用的电子邮件发送接口，如下表所示。


****  

| 电子邮件发送接口 | 发布事件的方式 | 
| --- | --- | 
|  `SendEmail`  |  API 参数  | 
|  `SendTemplatedEmail`  |  API 参数  | 
|  `SendBulkTemplatedEmail`  |  API 参数  | 
|  `SendCustomVerificationEmail`  |  API 参数  | 
|  `SendRawEmail`  |  API 参数、特定于 Amazon SES 的电子邮件标头或自定义 MIME 标头   如果同时使用标头和 API 参数指定邮件标签，Amazon SES 仅使用通过 API 参数提供的邮件标签。Amazon SES 不会合并由 API 参数和标头指定的邮件标签。   | 
|  SMTP 接口  |  特定于 Amazon SES 的电子邮件标头  | 

以下部分介绍如何使用标头和使用 API 参数指定配置集和邮件标签。
+ [使用 Amazon SES API 参数](#event-publishing-using-ses-parameters)
+ [使用特定于 Amazon SES 的电子邮件标头](#event-publishing-using-ses-headers)
+ [使用自定义电子邮件标头](#event-publishing-using-custom-headers)

**注意**  
还可以选择性地在电子邮件标头中包含邮件标签。邮件标签可以包含数字 0-9、字母 A-Z（大写和小写字母）、连字符（-）和下划线（\$1）。

## 使用 Amazon SES API 参数
<a name="event-publishing-using-ses-parameters"></a>

要将[SendEmail](https://docs.aws.amazon.com/ses/latest/APIReference/API_SendEmail.html)、[SendTemplatedEmail](https://docs.aws.amazon.com/ses/latest/APIReference/API_SendTemplatedEmail.html)、[SendBulkTemplatedEmail[SendCustomVerificationEmail](https://docs.aws.amazon.com/ses/latest/APIReference/API_SendCustomVerificationEmail.html)](https://docs.aws.amazon.com/ses/latest/APIReference/API_SendBulkTemplatedEmail.html)、或[SendRawEmail](https://docs.aws.amazon.com/ses/latest/APIReference/API_SendRawEmail.html)与事件发布一起使用，您可以通过将调用的数据结构传递给 API 调用[MessageTag](https://docs.aws.amazon.com/ses/latest/APIReference/API_MessageTag.html)来指定配置集[ConfigurationSet](https://docs.aws.amazon.com/ses/latest/APIReference/API_ConfigurationSet.html)和消息标签。

有关使用 Amazon SES API 的更多信息，请参阅 [Amazon Simple Email Service API 参考](https://docs.aws.amazon.com/ses/latest/APIReference/)。

## 使用特定于 Amazon SES 的电子邮件标头
<a name="event-publishing-using-ses-headers"></a>

在使用 `SendRawEmail` 或 SMTP 接口时，您可以通过将特定于 Amazon SES 的标头添加到电子邮件来指定配置集和邮件标签。Amazon SES 将删除标头，然后再发送电子邮件。下表显示了要使用的标头的名称。


| 事件发布信息 | 标题 | 
| --- | --- | 
|  配置集  |  `X-SES-CONFIGURATION-SET`  | 
|  邮件标签  |  `X-SES-MESSAGE-TAGS`  | 

以下示例显示了在提交至 Amazon SES 的原始电子邮件中标头的具体形式。

```
 1. X-SES-MESSAGE-TAGS: tagName1=tagValue1, tagName2=tagValue2
 2. X-SES-CONFIGURATION-SET: myConfigurationSet
 3. From: sender@example.com
 4. To: recipient@example.com
 5. Subject: Subject
 6. Content-Type: multipart/alternative;
 7. 	boundary="----=_boundary"
 8. 
 9. ------=_boundary
10. Content-Type: text/plain; charset=UTF-8
11. Content-Transfer-Encoding: 7bit
12. 
13. body
14. ------=_boundary
15. Content-Type: text/html; charset=UTF-8
16. Content-Transfer-Encoding: 7bit
17. 
18. body
19. ------=_boundary--
```

## 使用自定义电子邮件标头
<a name="event-publishing-using-custom-headers"></a>

尽管您必须使用特定于 Amazon SES 的标头 `X-SES-CONFIGURATION-SET` 指定配置集名称，但您可以使用自己的 MIME 标头指定邮件标签。

**注意**  
Amazon SES 事件发布使用的标头名称和值必须是 ASCII 码。如果您为 Amazon SES 事件发布指定非 ASCII 标头名称或值，则电子邮件发送调用仍会成功，但不会向亚马逊发送事件指标。 CloudWatch

# 使用 Amazon SES 事件数据
<a name="working-with-event-data"></a>

您[设置事件发布](monitor-sending-using-event-publishing-setup.md)并为发送的电子邮件指定配置集后，可以从您在设置与电子邮件关联的配置集时指定的事件目标检索电子邮件发送事件。

本节介绍如何从 Amazon CloudWatch 和 Amazon Data Firehose 检索电子邮件发送事件，以及如何解释 Amazon SNS 提供的事件数据。
+ [正在从中检索 Amazon SES 事件数据 CloudWatch](event-publishing-retrieving-cloudwatch.md)
+ [从 Firehose 检索 Amazon SES 事件数据](event-publishing-retrieving-firehose.md)
+ [解释来自 Amazon SNS 的 Amazon SES 事件数据](event-publishing-retrieving-sns.md)

# 正在从中检索 Amazon SES 事件数据 CloudWatch
<a name="event-publishing-retrieving-cloudwatch"></a>

Amazon SES 可以发布您向亚马逊发送电子邮件事件的指标 CloudWatch。当您将事件数据发布到时 CloudWatch，它会将这些指标作为一组有序的时间序列数据提供。您可以使用这些指标来监控您的电子邮件发送的性能。例如，您可以监控投诉指标并设置 CloudWatch 警报，使其在指标超过特定值时触发。

Amazon SES 可以在两个级别上将这些事件发布到 CloudWatch：
+ **在您的 AWS 账户** — 这些粗略指标与您使用 Amazon SES 控制台和 `GetSendStatistics` API 监控的指标相对应，是您的整个指标的总和。 AWS 账户 Amazon SES CloudWatch 会自动将这些指标发布到。
+ **精细** – 这些指标将按您使用*邮件标记*定义的电子邮件特征分类。要将这些指标发布到 CloudWatch，您必须使用[事件目标设置 CloudWatch 事件发布](monitor-sending-using-event-publishing-setup.md)[，并在发送电子邮件时指定配置集](event-publishing-send-email.md)。您也可以指定邮件标记或使用 Amazon SES 自动提供的 [auto-tags](monitor-using-event-publishing.md#event-publishing-how-works)。

此部分介绍可用指标以及如何在 CloudWatch 中查看这些指标。

## 可用指标
<a name="event-publishing-retrieving-cloudwatch-metrics"></a>

您可以将以下 Amazon SES 电子邮件发送指标发布到 CloudWatch：
+ **Send**（发送）– 发送请求成功，Amazon SES 将尝试将邮件发送到收件人的邮件服务器。（如果使用账户级别或全局抑制，SES 仍会将其计为发送，但会抑制送达。）
+ **RenderingFailure**— 由于模板渲染问题，电子邮件未发送。当模板数据丢失或模板参数与数据不匹配时，可能会发生此事件类型。（此事件类型仅在您使用 [https://docs.aws.amazon.com/ses/latest/APIReference/API_SendTemplatedEmail.html](https://docs.aws.amazon.com/ses/latest/APIReference/API_SendTemplatedEmail.html) 或 [https://docs.aws.amazon.com/ses/latest/APIReference/API_SendBulkTemplatedEmail.html](https://docs.aws.amazon.com/ses/latest/APIReference/API_SendBulkTemplatedEmail.html) API 操作发送电子邮件时发生。）
+ **Reject**（拒绝）– Amazon SES 已接受电子邮件，但确定它包含病毒，而未尝试将其发送到收件人的邮件服务器。
+ **Delivery**（送达）– Amazon SES 成功将电子邮件发送到收件人的邮件服务器。
+ **退信** – 收件人的邮件服务器永久拒绝了电子邮件的*硬退信*。（仅当 S *ES 不再尝试发送电子邮件时，才会包含软退件*。 通常，这些软退件表示投递失败，尽管在某些情况下，即使邮件成功到达收件人收件箱，也可以返回软退件。 这通常发生在收件人发送 out-of-office自动回复时。 在这篇 re [AWS : Post 文章](https://repost.aws/knowledge-center/ses-understand-soft-bounces)中了解有关软反弹的更多信息。）
+ **Complaint**（投诉）– 电子邮件已成功送达收件人的邮件服务器，但收件人将其标记为垃圾邮件。
+ **DeliveryDelay**— 由于出现临时问题，无法将电子邮件发送到收件人的邮件服务器。例如，当收件人的收件箱已满，或者当接收电子邮件服务器遇到临时问题时，可能会发生传送延迟。
+ **Subscription**（订阅）– 电子邮件已成功发送，但收件人通过单击电子邮件标头中的 `List-Unsubscribe` 或脚注中的 `Unsubscribe` 链接更新了订阅首选项。
+ **Open**（打开）– 收件人已收到邮件并在其电子邮件客户端中打开了邮件。
+ **Click**（单击）– 收件人单击了电子邮件中包含的一个或多个链接。

## 可用维度
<a name="event-publishing-retrieving-cloudwatch-dimensions"></a>

CloudWatch 使用您在向 Amazon SES 中的配置集添加 CloudWatch 事件目标时指定的维度名称。有关更多信息，请参阅 [为 CloudWatch 活动发布设置活动目的地](event-publishing-add-event-destination-cloudwatch.md)。

## 在 CloudWatch 控制台中查看 Amazon SES 指标
<a name="event-publishing-retrieving-cloudwatch-console"></a>

以下过程介绍如何使用 CloudWatch 控制台查看 Amazon SES 事件发布指标。

**使用 CloudWatch 控制台查看指标**

1. 登录 AWS 管理控制台 并打开 CloudWatch 控制台，网址为[https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/)。

1. 如果需要，可以更改区域。在导航栏中，选择您的 AWS 资源所在的区域。有关更多信息，请参阅[区域和端点](https://docs.aws.amazon.com/general/latest/gr/rande.html)。

1. 在导航窗格中，选择**所有指标**。

1. 在**指标**窗格中，选择 **SES**。

1. 选择要查看的指标。要查看精细[事件发布指标](monitor-using-event-publishing.md)，请选择在[设置 CloudWatch 事件目标](event-publishing-add-event-destination-cloudwatch.md)时指定的维度组合。要详细了解如何使用查看指标 CloudWatch，请参阅[使用 Amazon CloudWatch 指标](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/working_with_metrics.html)。

**要查看指标，请使用 AWS CLI**
+ 在命令提示符处输入下面的命令：

  ```
  1. aws cloudwatch list-metrics --namespace "AWS/SES"
  ```

# 从 Firehose 检索 Amazon SES 事件数据
<a name="event-publishing-retrieving-firehose"></a>

Amazon SES 将电子邮件发送事件作为 JSON 记录发布到 Firehose。然后，Firehose 会将记录发布到你在 Firehose 中设置传送流时选择的 AWS 服务目的地。有关设置 Firehose 传输流的更多信息，请参阅《Amazon Data Firehose Developer Guide》**中的 [Creating an Firehose Delivery Stream](https://docs.aws.amazon.com/firehose/latest/dev/basic-create.html)。

**Topics**
+ [

# Amazon SES 发布到 Firehose 的事件数据的内容
](event-publishing-retrieving-firehose-contents.md)
+ [

# Amazon SES 发布到 Firehose 的事件数据的示例
](event-publishing-retrieving-firehose-examples.md)

# Amazon SES 发布到 Firehose 的事件数据的内容
<a name="event-publishing-retrieving-firehose-contents"></a>

Amazon SES 以 JSON 格式将电子邮件发送事件记录发布到 Amazon Data Firehose。在将事件发布到 Firehose 时，Amazon SES 在每个 JSON 记录后跟一个换行符。

您可以在 [Amazon SES 发布到 Firehose 的事件数据的示例](event-publishing-retrieving-firehose-examples.md) 中找到所有这些通知类型的示例记录。

**Topics**
+ [

## 顶级 JSON 对象
](#event-publishing-retrieving-firehose-contents-top-level-json-object)
+ [

## 邮件对象
](#event-publishing-retrieving-firehose-contents-mail-object)
+ [

## 退信对象
](#event-publishing-retrieving-firehose-contents-bounce-object)
+ [

## 投诉对象
](#event-publishing-retrieving-firehose-contents-complaint-object)
+ [

## 送达对象
](#event-publishing-retrieving-firehose-contents-delivery-object)
+ [

## 发送对象
](#event-publishing-retrieving-firehose-contents-send-object)
+ [

## 拒绝对象
](#event-publishing-retrieving-firehose-contents-reject-object)
+ [

## 打开对象
](#event-publishing-retrieving-firehose-contents-open-object)
+ [

## 单击对象
](#event-publishing-retrieving-firehose-contents-click-object)
+ [

## 呈现失败对象
](#event-publishing-retrieving-firehose-contents-failure-object)
+ [

## DeliveryDelay 对象
](#event-publishing-retrieving-firehose-delivery-delay-object)
+ [

## 订阅对象
](#event-publishing-retrieving-firehose-subscription-object)

## 顶级 JSON 对象
<a name="event-publishing-retrieving-firehose-contents-top-level-json-object"></a>

电子邮件发送事件记录中的顶级 JSON 对象包含以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `eventType`  |  一个描述事件类型的文本字符串。可能的值：`Bounce`、`Complaint`、`Delivery`、`Send`、`Reject`、`Open`、`Click`、`Rendering Failure`、`DeliveryDelay` 或 `Subscription`。 如果尚未[设置事件发布](monitor-sending-using-event-publishing-setup.md)，则此字段将命名为 `notificationType`。  | 
|  `mail`  |  JSON 对象，包含有关生成事件的电子邮件的信息。  | 
|  `bounce`  |  仅当 `eventType` 为 `Bounce` 时，此字段才存在。它包含有关退信的信息。  | 
|  `complaint`  |  仅当 `eventType` 为 `Complaint` 时，此字段才存在。它包含有关投诉的信息。  | 
|  `delivery`  |  仅当 `eventType` 为 `Delivery` 时，此字段才存在。它包含有关送达的信息。  | 
|  `send`  |  仅当 `eventType` 为 `Send` 时，此字段才存在。  | 
|  `reject`  |  仅当 `eventType` 为 `Reject` 时，此字段才存在。它包含有关拒绝的信息。  | 
|  `open`  |  仅当 `eventType` 为 `Open` 时，此字段才存在。它包含有关打开事件的信息。  | 
|  `click`  |  仅当 `eventType` 为 `Click` 时，此字段才存在。它包含有关点击事件的信息。  | 
| `failure` | 仅当 `eventType` 为 `Rendering Failure` 时，此字段才存在。它包含有关呈现失败事件的信息。 | 
|  `deliveryDelay`  |  仅当 `eventType` 为 `DeliveryDelay` 时，此字段才存在。它包含有关延迟送达电子邮件的信息。  | 
|  `subscription`  |  仅当 `eventType` 为 `Subscription` 时，此字段才存在。它包含有关订阅首选项的信息。  | 

## 邮件对象
<a name="event-publishing-retrieving-firehose-contents-mail-object"></a>

每个电子邮件发送事件记录都包含有关 `mail` 对象中的原始电子邮件的信息。包含有关 `mail` 对象的信息的 JSON 对象具有以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `timestamp`  |  发送消息的日期和时间， ISO8601 格式为 (*YYYY-MM--: mm: ss.sz DDThh*)。  | 
|  `messageId`  |  Amazon SES 分配给电子邮件的唯一 ID。Amazon SES 在您发送邮件时已向您返回此值。  此邮件 ID 已由 Amazon SES 分配。您可以在 `mail` 对象的 `headers` 和 `commonHeaders` 字段中找到原始电子邮件的邮件 ID。   | 
|  `source`  |  发送邮件的电子邮件地址（信封 MAIL FROM 地址）。  | 
|  `sourceArn`  |  已用于发送电子邮件的身份的 Amazon Resource Name（ARN）。在发送授权的情况下，`sourceArn` 是身份拥有者授权委托发件人用于发送电子邮件的身份的 ARN。有关发送授权的更多信息，请参阅[电子邮件身份验证方法使用发送授权](sending-authorization.md)。  | 
|  `sendingAccountId`  |  用于发送电子邮件的账户的账户 ID。 AWS 在发送授权的情况下，`sendingAccountId` 是委托发件人的账户 ID。  | 
|  `destination`  |  作为原始邮件的收件人的电子邮件地址的列表。  | 
|  `headersTruncated`  |  一个字符串，指定标头是否会在通知中被截断，如果标头大于 10 KB，则会发生截断。可能的值为 `true` 和 `false`。  | 
|  `headers`  |  电子邮件的原始标头的列表。列表中的每个标头均有一个 `name` 字段和一个 `value` 字段。  `headers` 字段内的任何邮件 ID 均来自您传递至 Amazon SES 的原始邮件。Amazon SES 随后分配给电子邮件的邮件 ID 位于 `messageId` 对象的 `mail` 字段中。   | 
|  `commonHeaders`  |  电子邮件的原始常用标头的映射。  `commonHeaders` 字段中的任何邮件 ID 是 Amazon SES 随后在 `mail` 对象的 `messageId` 字段中分配给邮件的邮件 ID。   | 
|  `tags`  |  与电子邮件关联的标签的列表。  | 

## 退信对象
<a name="event-publishing-retrieving-firehose-contents-bounce-object"></a>

包含有关 `Bounce` 事件的信息的 JSON 对象将始终具有以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `bounceType`  |  退信的类型，由 Amazon SES 确定。  | 
|  `bounceSubType`  |  退信的子类型，由 Amazon SES 确定。  | 
|  `bouncedRecipients`  |  包含已退回的原始邮件收件人相关信息的列表。  | 
|  `timestamp`  |  互联网服务提供商发送退回通知的日期和时间， ISO8601 格式为 (*YYYY-MM--: mm: ss.sz DDThh*)。  | 
|  `feedbackId`  |  退信的唯一 ID。  | 
|  `reportingMTA`  |  DSN 中的 `Reporting-MTA` 字段的值。这是尝试执行 DSN 所述的传输、中继或网关操作的 Message Transfer Authority（MTA）的值。  此字段仅在传输状态通知（DSN）附加到退信时显示。   | 

### 退信的收件人
<a name="event-publishing-retrieving-firehose-contents-bounced-recipients"></a>

退信事件可能与一个收件人或多个收件人有关。`bouncedRecipients` 字段包含一系列对象（与退信事件相关的每个收件人各有一个对象）并将始终包含以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `emailAddress`  |  收件人的电子邮件地址。如果 DSN 可用，这将是 DSN 中的 `Final-Recipient` 字段的值。  | 

（可选）如果 DSN 已附加到退信，则以下字段也可能存在。


| 字段名称 | 说明 | 
| --- | --- | 
|  `action`  |  DSN 中的 `Action` 字段的值。这表示报告 MTA 因尝试将邮件传输至此收件人而需执行的操作。  | 
|  `status`  |  DSN 中的 `Status` 字段的值。这是每个收件人与传输无关的状态代码，用于指示邮件的传输状态。  | 
|  `diagnosticCode`  |  报告 MTA 发放的状态代码。这是 DSN 中的 `Diagnostic-Code` 字段的值。此字段可能不在 DSN 中（因此也不在 JSON 中）。  | 

### 退信类型
<a name="event-publishing-retrieving-firehose-contents-bounce-types"></a>

每个退信事件都属于下表中所示的类型之一。

事件发布系统仅发布不再由 Amazon SES 重试的硬退信和软退信。收到标有 `Permanent` 的退信时，应从邮件列表中删除对应的电子邮件地址；您将来无法向这些地址发送邮件。当某封邮件被软退回若干次并且 Amazon SES 已停止尝试再次传送它之后，系统将向您发送 `Transient` 退信。您将来或许能够成功重新发送到最初导致了 `Transient` 退信的地址。


| bounceType | bounceSubType | 说明 | 
| --- | --- | --- | 
|  `Undetermined`  |  `Undetermined`  |  Amazon SES 无法确定特定的退信原因。  | 
|  `Permanent`  |  `General`  |  Amazon SES 收到了一封常规硬退信。如果您收到此类退信，您应从邮件列表中删除收件人的电子邮件地址。  | 
|  `Permanent`  |  `NoEmail`  |  Amazon SES 收到永久硬退信，因为目标电子邮件地址不存在。如果您收到此类退信，您应从邮件列表中删除收件人的电子邮件地址。  | 
|  `Permanent`  |  `Suppressed`  |  Amazon SES 已禁止发送邮件到此地址，因为该地址最近出现过做作为无效地址被退回的历史记录。要覆盖全局黑名单，请参阅 [使用 Amazon SES 账户级黑名单](sending-email-suppression-list.md)。  | 
| Permanent | OnAccountSuppressionList | Amazon SES 已禁止发送到此地址，因为该地址已被加入[账户级黑名单](sending-email-suppression-list.md)。这不计入您的跳出率指标。 | 
|  `Transient`  |  `General`  |  Amazon SES 收到常规退信。将来，您也许能够向该收件人成功发送电子邮件。  | 
|  `Transient`  |  `MailboxFull`  |  Amazon SES 收到邮箱完全退信。将来，您也许能够向该收件人成功发送电子邮件。  | 
|  `Transient`  |  `MessageTooLarge`  |  Amazon SES 收到消息太大退信。如果您减小邮件的大小，则也许能够向该收件人成功发送电子邮件。  | 
|  `Transient`  |  `CustomTimeoutExceeded`  |  Amazon SES 无法在电子邮件发件人指定的时间内成功传送电子邮件。*（退回消息将指定在定义的 TTL 内任何可能的传送尝试失败的原因。）*   | 
|  `Transient`  |  `ContentRejected`  |  Amazon SES 收到内容拒绝退信。如果您更改邮件的内容，则也许能够向该收件人成功发送电子邮件。  | 
|  `Transient`  |  `AttachmentRejected`  |  Amazon SES 收到附件拒绝退信。如果您删除或更改附件，则也许能够向该收件人成功发送电子邮件。  | 

## 投诉对象
<a name="event-publishing-retrieving-firehose-contents-complaint-object"></a>

包含有关 `Complaint` 事件的信息的 JSON 对象具有以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `complainedRecipients`  |  包含可能已提交投诉的收件人的相关信息列表。  | 
|  `timestamp`  |  互联网服务提供商发送投诉通知的日期和时间， ISO8601 格式为 (*YYYY-MM--: mm: ss.sz DDThh*)。  | 
|  `feedbackId`  |  投诉的唯一 ID。  | 
|  `complaintSubType`  |  投诉的子类型，由 Amazon SES 确定。  | 

此外，如果反馈报告已附加到投诉，则以下字段也可能存在。


| 字段名称 | 说明 | 
| --- | --- | 
|  `userAgent`  |  反馈报告中的 `User-Agent` 字段的值。此值表示生成了报告的系统的名称和版本。  | 
|  `complaintFeedbackType`  |  从 ISP 收到的反馈报告中的 `Feedback-Type` 字段的值。此值包含反馈的类型。  | 
|  `arrivalDate`  |  反馈报告中`Arrival-Date`或`Received-Date`字段的值， ISO8601 格式为 (*YYYY-MM--*: mm: ss.sz)。DDThh此字段可能不在报告中（因此也不在 JSON 中）。  | 

### 已投诉的收件人
<a name="event-publishing-retrieving-firehose-contents-complained-recipients"></a>

`complainedRecipients` 字段包含可能已提交投诉的收件人的列表。

**重要**  
由于大多数 ISPs 人会从投诉通知中删除提交投诉的收件人的电子邮件地址，因此此列表包含有关可能发送投诉的收件人的信息，这些信息基于原始邮件的收件人和我们收到投诉的互联网服务提供商。Amazon SES 对原始邮件执行查找以确定此收件人列表。

此列表中的 JSON 对象包含以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `emailAddress`  |  收件人的电子邮件地址。  | 

### 投诉类型
<a name="event-publishing-retrieving-firehose-contents-complaint-types"></a>

根据`complaintFeedbackType`互联网编号分配机构网站[，您可在由报告 ISP 分配的 ](https://www.iana.org/assignments/marf-parameters/marf-parameters.xml#marf-parameters-2) 字段中看到以下投诉类型：


| 字段名称 | 说明 | 
| --- | --- | 
|  `abuse`  |  指示未经请求的电子邮件或某种其他类型的电子邮件滥用。  | 
|  `auth-failure`  |  电子邮件身份验证失败报告。  | 
|  `fraud`  |  指示某种欺诈或网络钓鱼活动。  | 
|  `not-spam`  |  指示提供报告的实体不会将邮件视为垃圾邮件。这可用于更正被错误地标记或分类为垃圾邮件的邮件。  | 
|  `other`  |  指示不适合其他已注册类型的任何其他反馈。  | 
|  `virus`  |  报告在原始邮件中发现病毒。  | 

## 送达对象
<a name="event-publishing-retrieving-firehose-contents-delivery-object"></a>

包含有关 `Delivery` 事件的信息的 JSON 对象将始终具有以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `timestamp`  |  Amazon SES 将电子邮件发送到收件人的邮件服务器的日期和时间， ISO8601 格式为 (*YYYY-MM--*: mm: ss.sz)。DDThh  | 
|  `processingTimeMillis`  |  从 Amazon SES 接受来自发件人的请求到 Amazon SES 将邮件传递到收件人的邮件服务器的时间（以毫秒为单位）。  | 
|  `recipients`  |  传送事件应用于的预定收件人的列表。  | 
|  `smtpResponse`  |  从 Amazon SES 接受电子邮件的远程 ISP 的 SMTP 响应消息。此消息因电子邮件、接收邮件服务器以及接收 ISP 而异。  | 
|  `reportingMTA`  |  发送邮件的 Amazon SES 邮件服务器的主机名。  | 
|  `remoteMtaIp`  |  Amazon SES 将电子邮件送达的 MTA 的 IP 地址。  | 

## 发送对象
<a name="event-publishing-retrieving-firehose-contents-send-object"></a>

包含有关 `send` 事件的信息的 JSON 对象始终为空。

## 拒绝对象
<a name="event-publishing-retrieving-firehose-contents-reject-object"></a>

包含有关 `Reject` 事件的信息的 JSON 对象将始终具有以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `reason`  |  电子邮件被拒绝的原因。唯一可能的值为 `Bad content`，这意味着 Amazon SES 检测到该电子邮件含有病毒。当某个邮件被拒绝时，Amazon SES 会停止处理该邮件，并且不会尝试将邮件发送到收件人的邮件服务器。  | 

## 打开对象
<a name="event-publishing-retrieving-firehose-contents-open-object"></a>

包含有关 `Open` 事件的信息的 JSON 对象将始终包含以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `ipAddress`  |  收件人的 IP 地址。  | 
|  `timestamp`  |  公开事件发生的日期和时间， ISO8601 格式为 (*YYYY-MM--*: mm: ss.sz)。DDThh  | 
|  `userAgent`  |  收件人用于打开电子邮件中的设备或电子邮件客户端的用户代理。  | 

## 单击对象
<a name="event-publishing-retrieving-firehose-contents-click-object"></a>

包含有关 `Click` 事件的信息的 JSON 对象将始终包含以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `ipAddress`  |  收件人的 IP 地址。  | 
|  `timestamp`  |  点击事件发生的日期和时间， ISO8601 格式为 (*YYYY-MM--*: mm: ss.sz)。DDThh  | 
|  `userAgent`  |  收件人单击电子邮件中链接时使用的客户端的用户代理。  | 
|  `link`  |  收件人点击的链接的 URL。  | 
|  `linkTags`  |  使用 `ses:tags` 属性添加到链接的标签的列表。有关向电子邮件中的链接添加标签的更多信息，请参阅 [Amazon SES 电子邮件发送指标 FAQs](faqs-metrics.md)中的[问题 5：我能否用唯一标识符来标记链接？](faqs-metrics.md#sending-metric-faqs-clicks-q5)。  | 

## 呈现失败对象
<a name="event-publishing-retrieving-firehose-contents-failure-object"></a>

包含有关 `Rendering Failure` 事件的信息的 JSON 对象具有以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `templateName`  |  用于发送电子邮件的模板的名称。  | 
|  `errorMessage`  |  提供有关呈现失败详细信息的消息。  | 

## DeliveryDelay 对象
<a name="event-publishing-retrieving-firehose-delivery-delay-object"></a>

包含有关 `DeliveryDelay` 事件的信息的 JSON 对象具有以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `delayType`  |  延迟的类型。可能的值有： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/ses/latest/dg/event-publishing-retrieving-firehose-contents.html)  | 
|  `delayedRecipients`  |  包含有关电子邮件收件人的信息的对象。  | 
|  `expirationTime`  |  Amazon SES 将停止尝试传输邮件的日期和时间。此值以 ISO 8601 格式显示。  | 
|  `reportingMTA`  |  报告延迟的邮件传输代理（MTA）的 IP 地址。  | 
|  `timestamp`  |  发生延迟的日期和时间，以 ISO 8601 格式显示。  | 

### 延迟的收件人
<a name="event-publishing-retrieving-firehose-contents-delivery-delay-object-recipients"></a>

`delayedRecipients` 对象包含以下值。


| 字段名称 | 说明 | 
| --- | --- | 
|  `emailAddress`  |  导致邮件送达延迟的电子邮件地址。  | 
|  `status`  |  与送达延迟关联的 SMTP 状态代码。  | 
|  `diagnosticCode`  |  接收邮件传输代理（MTA）提供的诊断代码。  | 

## 订阅对象
<a name="event-publishing-retrieving-firehose-subscription-object"></a>

包含有关 `Subscription` 事件的信息的 JSON 对象具有以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `contactList`  |  联系人所在的列表的名称。  | 
|  `timestamp`  |  ISP 发送订阅通知的日期和时间， ISO8601 格式为 *(YYYY-MM--: mm: ss.sz DDThh*)。  | 
|  `source`  |  发送邮件的电子邮件地址（信封 MAIL FROM 地址）。  | 
|  `newTopicPreferences`  |  一个 JSON 数据结构（映射），它指定联系人列表中所有主题的订阅状态，用于指示更改后的状态（联系人已订阅或已取消订阅）。  | 
|  `oldTopicPreferences`  |  一个 JSON 数据结构（映射），它指定联系人列表中所有主题的订阅状态，用于指示更改前的状态（联系人已订阅或已取消订阅）。  | 

### 新/旧主题首选项
<a name="event-publishing-retrieving-firehose-contents-subscription-object-topic-preferences"></a>

`newTopicPreferences` 和 `oldTopicPreferences` 对象包含以下值。


| 字段名称 | 说明 | 
| --- | --- | 
|  `unsubscribeAll`  |  指定联系人是否已取消订阅联系人列表中的所有主题。  | 
|  `topicSubscriptionStatus`  |  在 `topicName` 字段中指定主题的订阅状态，该字段指示该主题当前是否已订阅以接收来自 SES 的指定事件类型的通知。字段中可能的值为 **OptIn**（已订阅）或 **OptOut**（取消订阅）。`subscriptionStatus`  | 
|  `topicDefaultSubscriptionStatus`  |  在 `topicName` 字段中指定主题的默认订阅状态，以确定默认情况下是订阅还是取消订阅添加到事件目标的新主题。字段中可能的值为 **OptIn**（默认情况下已订阅）或 **OptOut**（默认取消订阅）。`subscriptionStatus`  | 

# Amazon SES 发布到 Firehose 的事件数据的示例
<a name="event-publishing-retrieving-firehose-examples"></a>

本节提供了一些示例，介绍 Amazon SES 发布到 Firehose 的电子邮件发送事件记录类型。

**Topics**
+ [

## 退信记录
](#event-publishing-retrieving-firehose-bounce)
+ [

## 投诉记录
](#event-publishing-retrieving-firehose-complaint)
+ [

## 送达记录
](#event-publishing-retrieving-firehose-delivery)
+ [

## 发送记录
](#event-publishing-retrieving-firehose-send)
+ [

## 拒绝记录
](#event-publishing-retrieving-firehose-reject)
+ [

## 打开记录
](#event-publishing-retrieving-firehose-open)
+ [

## 单击记录
](#event-publishing-retrieving-firehose-click)
+ [

## 呈现失败记录
](#event-publishing-retrieving-firehose-failure)
+ [

## DeliveryDelay 记录
](#event-publishing-retrieving-firehose-delayed-delivery)
+ [

## 订阅记录
](#event-publishing-retrieving-firehose-subscription)

**注意**  
在以下使用 `tag` 字段的示例中，它使用通过配置集发布事件，而 SES 支持发布所有事件类型的标签。如果直接使用关于身份的反馈通知，则 SES 不会发布标签。阅读有关在[创建配置集](creating-configuration-sets.md)或[修改配置集](managing-configuration-sets.md#console-detail-configuration-sets)时添加标签的内容。

## 退信记录
<a name="event-publishing-retrieving-firehose-bounce"></a>

下面是 Amazon SES 发布到 Firehose 的 `Bounce` 事件记录的一个示例。

```
 1. {
 2.   "eventType":"Bounce",
 3.   "bounce":{
 4.     "bounceType":"Permanent",
 5.     "bounceSubType":"General",
 6.     "bouncedRecipients":[
 7.       {
 8.         "emailAddress":"recipient@example.com",
 9.         "action":"failed",
10.         "status":"5.1.1",
11.         "diagnosticCode":"smtp; 550 5.1.1 user unknown"
12.       }
13.     ],
14.     "timestamp":"2017-08-05T00:41:02.669Z",
15.     "feedbackId":"01000157c44f053b-61b59c11-9236-11e6-8f96-7be8aexample-000000",
16.     "reportingMTA":"dsn; mta.example.com"
17.   },
18.   "mail":{
19.     "timestamp":"2017-08-05T00:40:02.012Z",
20.     "source":"Sender Name <sender@example.com>",
21.     "sourceArn":"arn:aws:ses:us-east-1:123456789012:identity/sender@example.com",
22.     "sendingAccountId":"123456789012",
23.     "messageId":"EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
24.     "destination":[
25.       "recipient@example.com"
26.     ],
27.     "headersTruncated":false,
28.     "headers":[
29.       {
30.         "name":"From",
31.         "value":"Sender Name <sender@example.com>"
32.       },
33.       {
34.         "name":"To",
35.         "value":"recipient@example.com"
36.       },
37.       {
38.         "name":"Subject",
39.         "value":"Message sent from Amazon SES"
40.       },
41.       {
42.         "name":"MIME-Version",
43.         "value":"1.0"
44.       },
45.       {
46.         "name":"Content-Type",
47.         "value":"multipart/alternative; boundary=\"----=_Part_7307378_1629847660.1516840721503\""
48.       }
49.     ],
50.     "commonHeaders":{
51.       "from":[
52.         "Sender Name <sender@example.com>"
53.       ],
54.       "to":[
55.         "recipient@example.com"
56.       ],
57.       "messageId":"EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
58.       "subject":"Message sent from Amazon SES"
59.     },
60.     "tags":{
61.       "ses:configuration-set":[
62.         "ConfigSet"
63.       ],
64.       "ses:source-ip":[
65.         "192.0.2.0"
66.       ],
67.       "ses:from-domain":[
68.         "example.com"
69.       ],
70.       "ses:caller-identity":[
71.         "ses_user"
72.       ]
73.     }
74.   }
75. }
```

## 投诉记录
<a name="event-publishing-retrieving-firehose-complaint"></a>

下面是 Amazon SES 发布到 Firehose 的 `Complaint` 事件记录的一个示例。

```
 1. {
 2.   "eventType":"Complaint",
 3.   "complaint": {
 4.     "complainedRecipients":[
 5.       {
 6.         "emailAddress":"recipient@example.com"
 7.       }
 8.     ],
 9.     "timestamp":"2017-08-05T00:41:02.669Z",
10.     "feedbackId":"01000157c44f053b-61b59c11-9236-11e6-8f96-7be8aexample-000000",
11.     "userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36",
12.     "complaintFeedbackType":"abuse",
13.     "arrivalDate":"2017-08-05T00:41:02.669Z"
14.   },
15.   "mail":{
16.     "timestamp":"2017-08-05T00:40:01.123Z",
17.     "source":"Sender Name <sender@example.com>",
18.     "sourceArn":"arn:aws:ses:us-east-1:123456789012:identity/sender@example.com",
19.     "sendingAccountId":"123456789012",
20.     "messageId":"EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
21.     "destination":[
22.       "recipient@example.com"
23.     ],
24.     "headersTruncated":false,
25.     "headers":[
26.       {
27.         "name":"From",
28.         "value":"Sender Name <sender@example.com>"
29.       },
30.       {
31.         "name":"To",
32.         "value":"recipient@example.com"
33.       },
34.       {
35.         "name":"Subject",
36.         "value":"Message sent from Amazon SES"
37.       },
38.       {
39.         "name":"MIME-Version","value":"1.0"
40.       },
41.       {
42.         "name":"Content-Type",
43.         "value":"multipart/alternative; boundary=\"----=_Part_7298998_679725522.1516840859643\""
44.       }
45.     ],
46.     "commonHeaders":{
47.       "from":[
48.         "Sender Name <sender@example.com>"
49.       ],
50.       "to":[
51.         "recipient@example.com"
52.       ],
53.       "messageId":"EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
54.       "subject":"Message sent from Amazon SES"
55.     },
56.     "tags":{
57.       "ses:configuration-set":[
58.         "ConfigSet"
59.       ],
60.       "ses:source-ip":[
61.         "192.0.2.0"
62.       ],
63.       "ses:from-domain":[
64.         "example.com"
65.       ],
66.       "ses:caller-identity":[
67.         "ses_user"
68.       ]
69.     }
70.   }
71. }
```

## 送达记录
<a name="event-publishing-retrieving-firehose-delivery"></a>

下面是 Amazon SES 发布到 Firehose 的 `Delivery` 事件记录的一个示例。

```
 1. {
 2.   "eventType": "Delivery",
 3.   "mail": {
 4.     "timestamp": "2016-10-19T23:20:52.240Z",
 5.     "source": "sender@example.com",
 6.     "sourceArn": "arn:aws:ses:us-east-1:123456789012:identity/sender@example.com",
 7.     "sendingAccountId": "123456789012",
 8.     "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
 9.     "destination": [
10.       "recipient@example.com"
11.     ],
12.     "headersTruncated": false,
13.     "headers": [
14.       {
15.         "name": "From",
16.         "value": "sender@example.com"
17.       },
18.       {
19.         "name": "To",
20.         "value": "recipient@example.com"
21.       },
22.       {
23.         "name": "Subject",
24.         "value": "Message sent from Amazon SES"
25.       },
26.       {
27.         "name": "MIME-Version",
28.         "value": "1.0"
29.       },
30.       {
31.         "name": "Content-Type",
32.         "value": "text/html; charset=UTF-8"
33.       },
34.       {
35.         "name": "Content-Transfer-Encoding",
36.         "value": "7bit"
37.       }
38.     ],
39.     "commonHeaders": {
40.       "from": [
41.         "sender@example.com"
42.       ],
43.       "to": [
44.         "recipient@example.com"
45.       ],
46.       "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
47.       "subject": "Message sent from Amazon SES"
48.     },
49.     "tags": {
50.       "ses:configuration-set": [
51.         "ConfigSet"
52.       ],
53.       "ses:source-ip": [
54.         "192.0.2.0"
55.       ],
56.       "ses:from-domain": [
57.         "example.com"
58.       ],
59.       "ses:caller-identity": [
60.         "ses_user"
61.       ],
62.       "ses:outgoing-ip": [
63.         "192.0.2.0"
64.       ],
65.       "myCustomTag1": [
66.         "myCustomTagValue1"
67.       ],
68.       "myCustomTag2": [
69.         "myCustomTagValue2"
70.       ]      
71.     }
72.   },
73.   "delivery": {
74.     "timestamp": "2016-10-19T23:21:04.133Z",
75.     "processingTimeMillis": 11893,
76.     "recipients": [
77.       "recipient@example.com"
78.     ],
79.     "smtpResponse": "250 2.6.0 Message received",
80.     "remoteMtaIp": "123.456.789.012",
81.     "reportingMTA": "mta.example.com"
82.   }
83. }
```

## 发送记录
<a name="event-publishing-retrieving-firehose-send"></a>

下面是 Amazon SES 发布到 Firehose 的 `Send` 事件记录的一个示例。

```
 1. {
 2.   "eventType": "Send",
 3.   "mail": {
 4.     "timestamp": "2016-10-14T05:02:16.645Z",
 5.     "source": "sender@example.com",
 6.     "sourceArn": "arn:aws:ses:us-east-1:123456789012:identity/sender@example.com",
 7.     "sendingAccountId": "123456789012",
 8.     "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
 9.     "destination": [
10.       "recipient@example.com"
11.     ],
12.     "headersTruncated": false,
13.     "headers": [
14.       {
15.         "name": "From",
16.         "value": "sender@example.com"
17.       },
18.       {
19.         "name": "To",
20.         "value": "recipient@example.com"
21.       },
22.       {
23.         "name": "Subject",
24.         "value": "Message sent from Amazon SES"
25.       },
26.       {
27.         "name": "MIME-Version",
28.         "value": "1.0"
29.       },
30.       {
31.         "name": "Content-Type",
32.         "value": "multipart/mixed;  boundary=\"----=_Part_0_716996660.1476421336341\""
33.       },
34.       {
35.         "name": "X-SES-MESSAGE-TAGS",
36.         "value": "myCustomTag1=myCustomTagValue1, myCustomTag2=myCustomTagValue2"
37.       }
38.     ],
39.     "commonHeaders": {
40.       "from": [
41.         "sender@example.com"
42.       ],
43.       "to": [
44.         "recipient@example.com"
45.       ],
46.       "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
47.       "subject": "Message sent from Amazon SES"
48.     },
49.     "tags": {
50.       "ses:configuration-set": [
51.         "ConfigSet"
52.       ],
53.       "ses:source-ip": [
54.         "192.0.2.0"
55.       ],
56.       "ses:from-domain": [
57.         "example.com"
58.       ],      
59.       "ses:caller-identity": [
60.         "ses_user"
61.       ],
62.       "myCustomTag1": [
63.         "myCustomTagValue1"
64.       ],
65.       "myCustomTag2": [
66.         "myCustomTagValue2"
67.       ]      
68.     }
69.   },
70.   "send": {}
71. }
```

## 拒绝记录
<a name="event-publishing-retrieving-firehose-reject"></a>

下面是 Amazon SES 发布到 Firehose 的 `Reject` 事件记录的一个示例。

```
 1. {
 2.   "eventType": "Reject",
 3.   "mail": {
 4.     "timestamp": "2016-10-14T17:38:15.211Z",
 5.     "source": "sender@example.com",
 6.     "sourceArn": "arn:aws:ses:us-east-1:123456789012:identity/sender@example.com",
 7.     "sendingAccountId": "123456789012",
 8.     "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
 9.     "destination": [
10.       "sender@example.com"
11.     ],
12.     "headersTruncated": false,
13.     "headers": [
14.       {
15.         "name": "From",
16.         "value": "sender@example.com"
17.       },
18.       {
19.         "name": "To",
20.         "value": "recipient@example.com"
21.       },      
22.       {
23.         "name": "Subject",
24.         "value": "Message sent from Amazon SES"
25.       },
26.       {
27.         "name": "MIME-Version",
28.         "value": "1.0"
29.       },      
30.       {
31.         "name": "Content-Type",
32.         "value": "multipart/mixed; boundary=\"qMm9M+Fa2AknHoGS\""
33.       },
34.       {
35.         "name": "X-SES-MESSAGE-TAGS",
36.         "value": "myCustomTag1=myCustomTagValue1, myCustomTag2=myCustomTagValue2"
37.       }  
38.     ],
39.     "commonHeaders": {
40.       "from": [
41.         "sender@example.com"
42.       ],
43.       "to": [
44.         "recipient@example.com"
45.       ],
46.       "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
47.       "subject": "Message sent from Amazon SES"
48.     },
49.     "tags": {
50.       "ses:configuration-set": [
51.         "ConfigSet"
52.       ],
53.       "ses:source-ip": [
54.         "192.0.2.0"
55.       ],
56.       "ses:from-domain": [
57.         "example.com"
58.       ],    
59.       "ses:caller-identity": [
60.         "ses_user"
61.       ],
62.       "myCustomTag1": [
63.         "myCustomTagValue1"
64.       ],
65.       "myCustomTag2": [
66.         "myCustomTagValue2"
67.       ]      
68.     }
69.   },
70.   "reject": {
71.     "reason": "Bad content"
72.   }
73. }
```

## 打开记录
<a name="event-publishing-retrieving-firehose-open"></a>

下面是 Amazon SES 发布到 Firehose 的 `Open` 事件记录的一个示例。

```
 1. {
 2.   "eventType": "Open",
 3.   "mail": {
 4.     "commonHeaders": {
 5.       "from": [
 6.         "sender@example.com"
 7.       ],
 8.       "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
 9.       "subject": "Message sent from Amazon SES",
10.       "to": [
11.         "recipient@example.com"
12.       ]
13.     },
14.     "destination": [
15.       "recipient@example.com"
16.     ],
17.     "headers": [
18.       {
19.         "name": "X-SES-CONFIGURATION-SET",
20.         "value": "ConfigSet"
21.       },
22.       {
23.         "name":"X-SES-MESSAGE-TAGS",
24.         "value":"myCustomTag1=myCustomValue1, myCustomTag2=myCustomValue2"
25.       },
26.       {
27.         "name": "From",
28.         "value": "sender@example.com"
29.       },
30.       {
31.         "name": "To",
32.         "value": "recipient@example.com"
33.       },
34.       {
35.         "name": "Subject",
36.         "value": "Message sent from Amazon SES"
37.       },
38.       {
39.         "name": "MIME-Version",
40.         "value": "1.0"
41.       },
42.       {
43.         "name": "Content-Type",
44.         "value": "multipart/alternative; boundary=\"XBoundary\""
45.       }
46.     ],
47.     "headersTruncated": false,
48.     "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
49.     "sendingAccountId": "123456789012",
50.     "source": "sender@example.com",
51.     "tags": {
52.       "myCustomTag1":[
53.         "myCustomValue1"
54.       ],
55.       "myCustomTag2":[
56.         "myCustomValue2"
57.       ],
58.       "ses:caller-identity": [
59.         "IAM_user_or_role_name"
60.       ],
61.       "ses:configuration-set": [
62.         "ConfigSet"
63.       ],
64.       "ses:from-domain": [
65.         "example.com"
66.       ],
67.       "ses:source-ip": [
68.         "192.0.2.0"
69.       ]
70.     },
71.     "timestamp": "2017-08-09T21:59:49.927Z"
72.   },
73.   "open": {
74.     "ipAddress": "192.0.2.1",
75.     "timestamp": "2017-08-09T22:00:19.652Z",
76.     "userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60"
77.   }
78. }
```

## 单击记录
<a name="event-publishing-retrieving-firehose-click"></a>

下面是 Amazon SES 发布到 Firehose 的 `Click` 事件记录的一个示例。

```
 1. {
 2.   "eventType": "Click",
 3.   "click": {
 4.     "ipAddress": "192.0.2.1",
 5.     "link": "http://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-smtp.html",
 6.     "linkTags": {
 7.       "samplekey0": [
 8.         "samplevalue0"
 9.       ],
10.       "samplekey1": [
11.         "samplevalue1"
12.       ]
13.     },
14.     "timestamp": "2017-08-09T23:51:25.570Z",
15.     "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36"
16.   },
17.   "mail": {
18.     "commonHeaders": {
19.       "from": [
20.         "sender@example.com"
21.       ],
22.       "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
23.       "subject": "Message sent from Amazon SES",
24.       "to": [
25.         "recipient@example.com"
26.       ]
27.     },
28.     "destination": [
29.       "recipient@example.com"
30.     ],
31.     "headers": [
32.       {
33.         "name": "X-SES-CONFIGURATION-SET",
34.         "value": "ConfigSet"
35.       },
36.       {
37.         "name":"X-SES-MESSAGE-TAGS",
38.         "value":"myCustomTag1=myCustomValue1, myCustomTag2=myCustomValue2"
39.       },
40.       {
41.         "name": "From",
42.         "value": "sender@example.com"
43.       },
44.       {
45.         "name": "To",
46.         "value": "recipient@example.com"
47.       },
48.       {
49.         "name": "Subject",
50.         "value": "Message sent from Amazon SES"
51.       },
52.       {
53.         "name": "MIME-Version",
54.         "value": "1.0"
55.       },
56.       {
57.         "name": "Content-Type",
58.         "value": "multipart/alternative; boundary=\"XBoundary\""
59.       },
60.       {
61.         "name": "Message-ID",
62.         "value": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000"
63.       }
64.     ],
65.     "headersTruncated": false,
66.     "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
67.     "sendingAccountId": "123456789012",
68.     "source": "sender@example.com",
69.     "tags": {
70.       "myCustomTag1":[
71.         "myCustomValue1"
72.       ],
73.       "myCustomTag2":[
74.         "myCustomValue2"
75.       ],
76.       "ses:caller-identity": [
77.         "ses_user"
78.       ],
79.       "ses:configuration-set": [
80.         "ConfigSet"
81.       ],
82.       "ses:from-domain": [
83.         "example.com"
84.       ],
85.       "ses:source-ip": [
86.         "192.0.2.0"
87.       ]
88.     },
89.     "timestamp": "2017-08-09T23:50:05.795Z"
90.   }
91. }
```

## 呈现失败记录
<a name="event-publishing-retrieving-firehose-failure"></a>

下面是 Amazon SES 发布到 Firehose 的 `Rendering Failure` 事件记录的一个示例。

```
 1. {
 2.   "eventType":"Rendering Failure",
 3.   "mail":{
 4.     "timestamp":"2018-01-22T18:43:06.197Z",
 5.     "source":"sender@example.com",
 6.     "sourceArn":"arn:aws:ses:us-east-1:123456789012:identity/sender@example.com",
 7.     "sendingAccountId":"123456789012",
 8.     "messageId":"EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
 9.     "destination":[
10.       "recipient@example.com"
11.     ],
12.     "headersTruncated":false,
13.     "tags":{
14.       "ses:configuration-set":[
15.         "ConfigSet"
16.       ]
17.     }
18.   },
19.   "failure":{
20.     "errorMessage":"Attribute 'attributeName' is not present in the rendering data.",
21.     "templateName":"MyTemplate"
22.   }
23. }
```

## DeliveryDelay 记录
<a name="event-publishing-retrieving-firehose-delayed-delivery"></a>

下面是 Amazon SES 发布到 Firehose 的 `DeliveryDelay` 事件记录的一个示例。

```
 1. {
 2.   "eventType": "DeliveryDelay",
 3.   "mail":{
 4.     "timestamp":"2020-06-16T00:15:40.641Z",
 5.     "source":"sender@example.com",
 6.     "sourceArn":"arn:aws:ses:us-east-1:123456789012:identity/sender@example.com",
 7.     "sendingAccountId":"123456789012",
 8.     "messageId":"EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
 9.     "destination":[
10.       "recipient@example.com"
11.     ],
12.     "headersTruncated":false,
13.     "tags":{
14.       "ses:configuration-set":[
15.         "ConfigSet"
16.       ]
17.     }
18.   },
19.   "deliveryDelay": {
20.     "timestamp": "2020-06-16T00:25:40.095Z",
21.     "delayType": "TransientCommunicationFailure",
22.     "expirationTime": "2020-06-16T00:25:40.914Z",
23.     "delayedRecipients": [{
24.       "emailAddress": "recipient@example.com",
25.       "status": "4.4.1",
26.       "diagnosticCode": "smtp; 421 4.4.1 Unable to connect to remote host"
27.     }]
28.   }
29. }
```

## 订阅记录
<a name="event-publishing-retrieving-firehose-subscription"></a>

下面是 Amazon SES 发布到 Firehose 的 `Subscription` 事件记录的一个示例。

```
 1. {
 2.   "eventType": "Subscription",
 3.   "mail": {
 4.     "timestamp": "2022-01-12T01:00:14.340Z",
 5.     "source": "sender@example.com",
 6.     "sourceArn": "arn:aws:ses:us-east-1:123456789012:identity/sender@example.com",
 7.     "sendingAccountId": "123456789012",
 8.     "messageId": "EXAMPLEe4bccb684-777bc8de-afa7-4970-92b0-f515137b1497-000000",
 9.     "destination": ["recipient@example.com"],
10.     "headersTruncated": false,
11.     "headers": [
12.       {
13.         "name": "From",
14.         "value": "sender@example.com"
15.       },
16.       {
17.         "name": "To",
18.         "value": "recipient@example.com"
19.       },
20.       {
21.         "name": "Subject",
22.         "value": "Message sent from Amazon SES"
23.       },
24.       {
25.         "name": "MIME-Version",
26.         "value": "1.0"
27.       },
28.       {
29.         "name": "Content-Type",
30.         "value": "text/html; charset=UTF-8"
31.       },
32.       {
33.         "name": "Content-Transfer-Encoding",
34.         "value": "7bit"
35.       }
36.     ],
37.     "commonHeaders": {
38.       "from": ["sender@example.com"],
39.       "to": ["recipient@example.com"],
40.       "messageId": "EXAMPLEe4bccb684-777bc8de-afa7-4970-92b0-f515137b1497-000000",
41.       "subject": "Message sent from Amazon SES"
42.     },
43.     "tags": {
44.       "ses:operation": ["SendEmail"],
45.       "ses:configuration-set": ["ConfigSet"],
46.       "ses:source-ip": ["192.0.2.0"],
47.       "ses:from-domain": ["example.com"],
48.       "ses:caller-identity": ["ses_user"],
49.       "myCustomTag1": ["myCustomValue1"],
50.       "myCustomTag2": ["myCustomValue2"]
51.     }
52.   },
53.   "subscription": {
54.     "contactList": "ContactListName",
55.     "timestamp": "2022-01-12T01:00:17.910Z",
56.     "source": "UnsubscribeHeader",
57.     "newTopicPreferences": {
58.       "unsubscribeAll": true,
59.       "topicSubscriptionStatus": [
60.         {
61.           "topicName": "ExampleTopicName",
62.           "subscriptionStatus": "OptOut"
63.         }
64.       ]
65.     },
66.     "oldTopicPreferences": {
67.       "unsubscribeAll": false,
68.       "topicSubscriptionStatus": [
69.         {
70.           "topicName": "ExampleTopicName",
71.           "subscriptionStatus": "OptOut"
72.         }
73.       ]
74.     }
75.   }
76. }
```

# 解释来自 Amazon SNS 的 Amazon SES 事件数据
<a name="event-publishing-retrieving-sns"></a>

Amazon SES 将电子邮件发送事件作为 JSON 记录发布到 Amazon Simple Notification Service（Amazon SNS）。然后，Amazon SNS 将通知发送到订阅了与事件目标关联的 Amazon SNS 主题的终端节点。有关设置 Amazon SNS 主题和订阅的信息，请参阅 *Amazon Simple Notification Service 开发人员指南*中的[入门](https://docs.aws.amazon.com/sns/latest/dg/GettingStarted.html)。

有关记录内容 (例如示例记录) 的说明，请参阅以下部分。
+ [事件记录内容](event-publishing-retrieving-sns-contents.md)
+ [事件记录示例](event-publishing-retrieving-sns-examples.md)

# Amazon SES 发布到 Amazon SNS 的事件数据的内容
<a name="event-publishing-retrieving-sns-contents"></a>

Amazon SES 以 JSON 格式将电子邮件发送事件记录发布到 Amazon Simple Notification Service。

您可以在 [Amazon SES 发布到 Amazon SNS 的事件数据示例](event-publishing-retrieving-sns-examples.md) 中找到所有这些通知类型的示例记录。

**Topics**
+ [

## 顶级 JSON 对象
](#event-publishing-retrieving-sns-contents-top-level-json-object)
+ [

## 邮件对象
](#event-publishing-retrieving-sns-contents-mail-object)
+ [

## 退信对象
](#event-publishing-retrieving-sns-contents-bounce-object)
+ [

## 投诉对象
](#event-publishing-retrieving-sns-contents-complaint-object)
+ [

## 送达对象
](#event-publishing-retrieving-sns-contents-delivery-object)
+ [

## 发送对象
](#event-publishing-retrieving-sns-contents-send-object)
+ [

## 拒绝对象
](#event-publishing-retrieving-sns-contents-reject-object)
+ [

## 打开对象
](#event-publishing-retrieving-sns-contents-open-object)
+ [

## 单击对象
](#event-publishing-retrieving-sns-contents-click-object)
+ [

## 呈现失败对象
](#event-publishing-retrieving-sns-contents-failure-object)
+ [

## DeliveryDelay 对象
](#event-publishing-retrieving-sns-contents-delivery-delay-object)
+ [

## 订阅对象
](#event-publishing-retrieving-sns-contents-subscription-object)

## 顶级 JSON 对象
<a name="event-publishing-retrieving-sns-contents-top-level-json-object"></a>

电子邮件发送事件记录中的顶级 JSON 对象包含以下字段。事件类型决定了存在哪些其他对象。


| 字段名称 | 说明 | 
| --- | --- | 
|  `eventType`  |  一个描述事件类型的文本字符串。可能的值：`Bounce`、`Complaint`、`Delivery`、`Send`、`Reject`、`Open`、`Click`、`Rendering Failure`、`DeliveryDelay` 或 `Subscription`。 如果尚未[设置事件发布](monitor-sending-using-event-publishing-setup.md)，则此字段将命名为 `notificationType`。  | 
|  `mail`  |  JSON 对象，包含有关生成事件的电子邮件的信息。  | 
|  `bounce`  |  仅当 `eventType` 为 `Bounce` 时，此字段才存在。它包含有关退信的信息。  | 
|  `complaint`  |  仅当 `eventType` 为 `Complaint` 时，此字段才存在。它包含有关投诉的信息。  | 
|  `delivery`  |  仅当 `eventType` 为 `Delivery` 时，此字段才存在。它包含有关送达的信息。  | 
|  `send`  |  仅当 `eventType` 为 `Send` 时，此字段才存在。  | 
|  `reject`  |  仅当 `eventType` 为 `Reject` 时，此字段才存在。它包含有关拒绝的信息。  | 
|  `open`  |  仅当 `eventType` 为 `Open` 时，此字段才存在。它包含有关打开事件的信息。  | 
|  `click`  |  仅当 `eventType` 为 `Click` 时，此字段才存在。它包含有关点击事件的信息。  | 
| `failure` | 仅当 `eventType` 为 `Rendering Failure` 时，此字段才存在。它包含有关呈现失败事件的信息。 | 
|  `deliveryDelay`  |  仅当 `eventType` 为 `DeliveryDelay` 时，此字段才存在。它包含有关延迟送达电子邮件的信息。  | 
|  `subscription`  |  仅当 `eventType` 为 `Subscription` 时，此字段才存在。它包含有关订阅首选项的信息。  | 

## 邮件对象
<a name="event-publishing-retrieving-sns-contents-mail-object"></a>

每个电子邮件发送事件记录都包含有关 `mail` 对象中的原始电子邮件的信息。包含有关 `mail` 对象的信息的 JSON 对象具有以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `timestamp`  |  发送消息的日期和时间， ISO8601 格式为 (*YYYY-MM--: mm: ss.sz DDThh*)。  | 
|  `messageId`  |  Amazon SES 分配给电子邮件的唯一 ID。Amazon SES 在您发送邮件时已向您返回此值。  此邮件 ID 已由 Amazon SES 分配。您可以在 `mail` 对象的 `headers` 和 `commonHeaders` 字段中找到原始电子邮件的邮件 ID。   | 
|  `source`  |  发送邮件的电子邮件地址（信封 MAIL FROM 地址）。  | 
|  `sourceArn`  |  已用于发送电子邮件的身份的 Amazon Resource Name（ARN）。在发送授权的情况下，`sourceArn` 是身份拥有者授权委托发件人用于发送电子邮件的身份的 ARN。有关发送授权的更多信息，请参阅[电子邮件身份验证方法使用发送授权](sending-authorization.md)。  | 
|  `sendingAccountId`  |  用于发送电子邮件的账户的账户 ID。 AWS 在发送授权的情况下，`sendingAccountId` 是委托发件人的账户 ID。  | 
|  `destination`  |  作为原始邮件的收件人的电子邮件地址的列表。  | 
|  `headersTruncated`  |  一个字符串，指定标头是否会在通知中被截断，如果标头大于 10 KB，则会发生截断。可能的值为 `true` 和 `false`。  | 
|  `headers`  |  电子邮件的原始标头的列表。列表中的每个标头均有一个 `name` 字段和一个 `value` 字段。  `headers` 字段内的任何邮件 ID 均来自您传递至 Amazon SES 的原始邮件。Amazon SES 随后分配给电子邮件的邮件 ID 位于 `messageId` 对象的 `mail` 字段中。   | 
|  `commonHeaders`  |  电子邮件的原始常用标头的映射。  `commonHeaders` 字段中的任何邮件 ID 是 Amazon SES 随后在 `mail` 对象的 `messageId` 字段中分配给邮件的邮件 ID。   | 
|  `tags`  |  与电子邮件关联的标签的列表。  | 

## 退信对象
<a name="event-publishing-retrieving-sns-contents-bounce-object"></a>

包含有关 `Bounce` 事件的信息的 JSON 对象具有以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `bounceType`  |  退信的类型，由 Amazon SES 确定。  | 
|  `bounceSubType`  |  退信的子类型，由 Amazon SES 确定。  | 
|  `bouncedRecipients`  |  包含已退回的原始邮件收件人相关信息的列表。  | 
|  `timestamp`  |  互联网服务提供商发送退回通知的日期和时间， ISO8601 格式为 (*YYYY-MM--: mm: ss.sz DDThh*)。  | 
|  `feedbackId`  |  退信的唯一 ID。  | 
|  `reportingMTA`  |  DSN 中的 `Reporting-MTA` 字段的值。这是尝试执行 DSN 所述的传输、中继或网关操作的 Message Transfer Authority（MTA）的值。  此字段仅在传输状态通知（DSN）附加到退信时显示。   | 

### 退信的收件人
<a name="event-publishing-retrieving-sns-contents-bounced-recipients"></a>

退信事件可能与一个收件人或多个收件人有关。`bouncedRecipients` 字段包含一系列对象（其电子邮件地址导致退信的每个收件人各有一个对象）并包含以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `emailAddress`  |  收件人的电子邮件地址。如果 DSN 可用，这将是 DSN 中的 `Final-Recipient` 字段的值。  | 

（可选）如果 DSN 已附加到退信，则以下字段也可能存在。


| 字段名称 | 说明 | 
| --- | --- | 
|  `action`  |  DSN 中的 `Action` 字段的值。这表示报告 MTA 因尝试将邮件传输至此收件人而需执行的操作。  | 
|  `status`  |  DSN 中的 `Status` 字段的值。这是每个收件人与传输无关的状态代码，用于指示邮件的传输状态。  | 
|  `diagnosticCode`  |  报告 MTA 发放的状态代码。这是 DSN 中的 `Diagnostic-Code` 字段的值。此字段可能不在 DSN 中（因此也不在 JSON 中）。  | 

### 退信类型
<a name="event-publishing-retrieving-sns-contents-bounce-types"></a>

每个退信事件都属于下表中所示的类型之一。

事件发布系统仅发布不再由 Amazon SES 重试的硬退信和软退信。收到标有 `Permanent` 的退信时，应从邮件列表中删除对应的电子邮件地址；您将来无法向这些地址发送邮件。当某封邮件被软退回若干次并且 Amazon SES 已停止尝试再次传送它之后，系统将向您发送 `Transient` 退信。您将来或许能够成功重新发送到最初导致了 `Transient` 退信的地址。


| bounceType | bounceSubType | 说明 | 
| --- | --- | --- | 
|  `Undetermined`  |  `Undetermined`  |  Amazon SES 无法确定特定的退信原因。  | 
|  `Permanent`  |  `General`  |  Amazon SES 收到了一封常规硬退信。如果您收到此类退信，您应从邮件列表中删除收件人的电子邮件地址。  | 
|  `Permanent`  |  `NoEmail`  |  Amazon SES 收到永久硬退信，因为目标电子邮件地址不存在。如果您收到此类退信，您应从邮件列表中删除收件人的电子邮件地址。  | 
|  `Permanent`  |  `Suppressed`  |  Amazon SES 已禁止发送邮件到此地址，因为该地址最近出现过做作为无效地址被退回的历史记录。要覆盖全局黑名单，请参阅 [使用 Amazon SES 账户级黑名单](sending-email-suppression-list.md)。  | 
| Permanent | OnAccountSuppressionList | Amazon SES 已禁止发送到此地址，因为该地址已被加入[账户级黑名单](sending-email-suppression-list.md)。这不计入您的跳出率指标。 | 
|  `Transient`  |  `General`  |  Amazon SES 收到常规退信。将来，您也许能够向该收件人成功发送电子邮件。  | 
|  `Transient`  |  `MailboxFull`  |  Amazon SES 收到邮箱完全退信。将来，您也许能够向该收件人成功发送电子邮件。  | 
|  `Transient`  |  `MessageTooLarge`  |  Amazon SES 收到消息太大退信。如果您减小邮件的大小，则也许能够向该收件人成功发送电子邮件。  | 
|  `Transient`  |  `CustomTimeoutExceeded`  |  Amazon SES 无法在电子邮件发件人指定的时间内成功传送电子邮件。*（退回消息将指定在定义的 TTL 内任何可能的传送尝试失败的原因。）*   | 
|  `Transient`  |  `ContentRejected`  |  Amazon SES 收到内容拒绝退信。如果您更改邮件的内容，则也许能够向该收件人成功发送电子邮件。  | 
|  `Transient`  |  `AttachmentRejected`  |  Amazon SES 收到附件拒绝退信。如果您删除或更改附件，则也许能够向该收件人成功发送电子邮件。  | 

## 投诉对象
<a name="event-publishing-retrieving-sns-contents-complaint-object"></a>

包含有关 `Complaint` 事件的信息的 JSON 对象具有以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `complainedRecipients`  |  包含可能已提交投诉的收件人的相关信息列表。  | 
|  `timestamp`  |  互联网服务提供商发送投诉通知的日期和时间， ISO8601 格式为 (*YYYY-MM--: mm: ss.sz DDThh*)。  | 
|  `feedbackId`  |  投诉的唯一 ID。  | 
|  `complaintSubType`  |  投诉的子类型，由 Amazon SES 确定。  | 

此外，如果反馈报告已附加到投诉，则以下字段也可能存在。


| 字段名称 | 说明 | 
| --- | --- | 
|  `userAgent`  |  反馈报告中的 `User-Agent` 字段的值。此值表示生成了报告的系统的名称和版本。  | 
|  `complaintFeedbackType`  |  从 ISP 收到的反馈报告中的 `Feedback-Type` 字段的值。此值包含反馈的类型。  | 
|  `arrivalDate`  |  反馈报告中`Arrival-Date`或`Received-Date`字段的值， ISO8601 格式为 (*YYYY-MM--*: mm: ss.sz)。DDThh此字段可能不在报告中（因此也不在 JSON 中）。  | 

### 已投诉的收件人
<a name="event-publishing-retrieving-sns-contents-complained-recipients"></a>

`complainedRecipients` 字段包含可能已提交投诉的收件人的列表。

**重要**  
大多数 ISPs 会删除提交投诉的收件人的电子邮件地址。出于此原因，`complainedRecipients` 字段包含域中已向其发送电子邮件而该地址发布了投诉通知的所有人的列表。

此列表中的 JSON 对象包含以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `emailAddress`  |  收件人的电子邮件地址。  | 

### 投诉类型
<a name="event-publishing-retrieving-sns-contents-complaint-types"></a>

根据`complaintFeedbackType`互联网编号分配机构网站[，您可在由报告 ISP 分配的 ](https://www.iana.org/assignments/marf-parameters/marf-parameters.xml#marf-parameters-2) 字段中看到以下投诉类型：


| 字段名称 | 说明 | 
| --- | --- | 
|  `abuse`  |  指示未经请求的电子邮件或某种其他类型的电子邮件滥用。  | 
|  `auth-failure`  |  电子邮件身份验证失败报告。  | 
|  `fraud`  |  指示某种欺诈或网络钓鱼活动。  | 
|  `not-spam`  |  指示提供报告的实体不会将邮件视为垃圾邮件。这可用于更正被错误地标记或分类为垃圾邮件的邮件。  | 
|  `other`  |  指示不适合其他已注册类型的任何其他反馈。  | 
|  `virus`  |  报告在原始邮件中发现病毒。  | 

### 投诉子类型
<a name="event-publishing-retrieving-sns-contents-complaint-subtypes"></a>

`complaintSubType` 字段的值可以为 null 或 `OnAccountSuppressionList`。如果该值为 `OnAccountSuppressionList`，则表示 Amazon SES 已接受邮件，但未尝试发送邮件，因为该地址已被加入[账户级黑名单](sending-email-suppression-list.md)。

## 送达对象
<a name="event-publishing-retrieving-sns-contents-delivery-object"></a>

包含有关 `Delivery` 事件的信息的 JSON 对象具有以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `timestamp`  |  Amazon SES 将电子邮件发送到收件人的邮件服务器的日期和时间， ISO8601 格式为 (*YYYY-MM--*: mm: ss.sz)。DDThh  | 
|  `processingTimeMillis`  |  从 Amazon SES 接受来自发件人的请求到 Amazon SES 将邮件传递到收件人的邮件服务器的时间（以毫秒为单位）。  | 
|  `recipients`  |  传送事件应用于的预定收件人的列表。  | 
|  `smtpResponse`  |  从 Amazon SES 接受电子邮件的远程 ISP 的 SMTP 响应消息。此消息因电子邮件、接收邮件服务器以及接收 ISP 而异。  | 
|  `reportingMTA`  |  发送邮件的 Amazon SES 邮件服务器的主机名。  | 
|  `remoteMtaIp`  |  Amazon SES 将电子邮件送达的 MTA 的 IP 地址。  | 

## 发送对象
<a name="event-publishing-retrieving-sns-contents-send-object"></a>

包含有关 `send` 事件的信息的 JSON 对象始终为空。

## 拒绝对象
<a name="event-publishing-retrieving-sns-contents-reject-object"></a>

包含有关 `Reject` 事件的信息的 JSON 对象具有以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `reason`  |  电子邮件被拒绝的原因。唯一可能的值为 `Bad content`，这意味着 Amazon SES 检测到该电子邮件含有病毒。当某个邮件被拒绝时，Amazon SES 会停止处理该邮件，并且不会尝试将邮件发送到收件人的邮件服务器。  | 

## 打开对象
<a name="event-publishing-retrieving-sns-contents-open-object"></a>

包含有关 `Open` 事件的信息的 JSON 对象具有以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `ipAddress`  |  收件人的 IP 地址。  | 
|  `timestamp`  |  公开事件发生的日期和时间， ISO8601 格式为 (*YYYY-MM--*: mm: ss.sz)。DDThh  | 
|  `userAgent`  |  收件人用于打开电子邮件中的设备或电子邮件客户端的用户代理。  | 

## 单击对象
<a name="event-publishing-retrieving-sns-contents-click-object"></a>

包含有关 `Click` 事件的信息的 JSON 对象具有以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `ipAddress`  |  收件人的 IP 地址。  | 
|  `timestamp`  |  点击事件发生的日期和时间， ISO8601 格式为 (*YYYY-MM--*: mm: ss.sz)。DDThh  | 
|  `userAgent`  |  收件人单击电子邮件中链接时使用的客户端的用户代理。  | 
|  `link`  |  收件人点击的链接的 URL。  | 
|  `linkTags`  |  使用 `ses:tags` 属性添加到链接的标签的列表。有关向电子邮件中的链接添加标签的更多信息，请参阅 [Amazon SES 电子邮件发送指标 FAQs](faqs-metrics.md)中的[问题 5：我能否用唯一标识符来标记链接？](faqs-metrics.md#sending-metric-faqs-clicks-q5)。  | 

## 呈现失败对象
<a name="event-publishing-retrieving-sns-contents-failure-object"></a>

包含有关 `Rendering Failure` 事件的信息的 JSON 对象具有以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `templateName`  |  用于发送电子邮件的模板的名称。  | 
|  `errorMessage`  |  提供有关呈现失败详细信息的消息。  | 

## DeliveryDelay 对象
<a name="event-publishing-retrieving-sns-contents-delivery-delay-object"></a>

包含有关 `DeliveryDelay` 事件的信息的 JSON 对象具有以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `delayType`  |  延迟的类型。可能的值有： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/ses/latest/dg/event-publishing-retrieving-sns-contents.html)  | 
|  `delayedRecipients`  |  包含有关电子邮件收件人的信息的对象。  | 
|  `expirationTime`  |  Amazon SES 将停止尝试传输邮件的日期和时间。此值以 ISO 8601 格式显示。  | 
|  `reportingMTA`  |  报告延迟的邮件传输代理（MTA）的 IP 地址。  | 
|  `timestamp`  |  发生延迟的日期和时间，以 ISO 8601 格式显示。  | 

### 延迟的收件人
<a name="event-publishing-retrieving-sns-contents-delivery-delay-object-recipients"></a>

`delayedRecipients` 对象包含以下值。


| 字段名称 | 说明 | 
| --- | --- | 
|  `emailAddress`  |  导致邮件送达延迟的电子邮件地址。  | 
|  `status`  |  与送达延迟关联的 SMTP 状态代码。  | 
|  `diagnosticCode`  |  接收邮件传输代理（MTA）提供的诊断代码。  | 

## 订阅对象
<a name="event-publishing-retrieving-sns-contents-subscription-object"></a>

包含有关 `Subscription` 事件的信息的 JSON 对象具有以下字段。


| 字段名称 | 说明 | 
| --- | --- | 
|  `contactList`  |  联系人所在的列表的名称。  | 
|  `timestamp`  |  互联网服务提供商发送订阅通知的日期和时间， ISO8601 格式为 *(YYYY-MM--: mm: ss.sz DDThh*)。  | 
|  `source`  |  发送邮件的电子邮件地址（信封 MAIL FROM 地址）。  | 
|  `newTopicPreferences`  |  一个 JSON 数据结构（映射），它指定联系人列表中所有主题的订阅状态，用于指示更改后的状态（联系人已订阅或已取消订阅）。  | 
|  `oldTopicPreferences`  |  一个 JSON 数据结构（映射），它指定联系人列表中所有主题的订阅状态，用于指示更改前的状态（联系人已订阅或已取消订阅）。  | 

### 新/旧主题首选项
<a name="event-publishing-retrieving-sns-contents-subscription-object-topic-preferences"></a>

`newTopicPreferences` 和 `oldTopicPreferences` 对象包含以下值。


| 字段名称 | 说明 | 
| --- | --- | 
|  `unsubscribeAll`  |  指定联系人是否已取消订阅联系人列表中的所有主题。  | 
|  `topicSubscriptionStatus`  |  在 `topicName` 字段中指定主题的订阅状态，该字段指示该主题当前是否已订阅以接收来自 SES 的指定事件类型的通知。字段中可能的值为 **OptIn**（已订阅）或 **OptOut**（取消订阅）。`subscriptionStatus`  | 
|  `topicDefaultSubscriptionStatus`  |  在 `topicName` 字段中指定主题的默认订阅状态，以确定默认情况下是订阅还是取消订阅添加到事件目标的新主题。字段中可能的值为 **OptIn**（默认情况下已订阅）或 **OptOut**（默认取消订阅）。`subscriptionStatus`  | 

# Amazon SES 发布到 Amazon SNS 的事件数据示例
<a name="event-publishing-retrieving-sns-examples"></a>

本节提供了一些示例，介绍 Amazon SES 发布到 Amazon SNS 的电子邮件发送事件记录类型。

**Topics**
+ [

## 退信记录
](#event-publishing-retrieving-sns-bounce)
+ [

## 投诉记录
](#event-publishing-retrieving-sns-complaint)
+ [

## 送达记录
](#event-publishing-retrieving-sns-delivery)
+ [

## 发送记录
](#event-publishing-retrieving-sns-send)
+ [

## 拒绝记录
](#event-publishing-retrieving-sns-reject)
+ [

## 打开记录
](#event-publishing-retrieving-sns-open)
+ [

## 单击记录
](#event-publishing-retrieving-sns-click)
+ [

## 呈现失败记录
](#event-publishing-retrieving-sns-failure)
+ [

## DeliveryDelay 记录
](#event-publishing-retrieving-sns-delayed-delivery)
+ [

## 订阅记录
](#event-publishing-retrieving-sns-subscription)

**注意**  
在以下使用 `tag` 字段的示例中，它使用通过配置集发布事件，而 SES 支持发布所有事件类型的标签。如果直接使用关于身份的反馈通知，则 SES 不会发布标签。阅读有关在[创建配置集](creating-configuration-sets.md)或[修改配置集](managing-configuration-sets.md#console-detail-configuration-sets)时添加标签的内容。

## 退信记录
<a name="event-publishing-retrieving-sns-bounce"></a>

下面是 Amazon SES 发布到 Amazon SNS 的 `Bounce` 事件记录的一个示例。

```
 1. {
 2.   "eventType":"Bounce",
 3.   "bounce":{
 4.     "bounceType":"Permanent",
 5.     "bounceSubType":"General",
 6.     "bouncedRecipients":[
 7.       {
 8.         "emailAddress":"recipient@example.com",
 9.         "action":"failed",
10.         "status":"5.1.1",
11.         "diagnosticCode":"smtp; 550 5.1.1 user unknown"
12.       }
13.     ],
14.     "timestamp":"2017-08-05T00:41:02.669Z",
15.     "feedbackId":"01000157c44f053b-61b59c11-9236-11e6-8f96-7be8aexample-000000",
16.     "reportingMTA":"dsn; mta.example.com"
17.   },
18.   "mail":{
19.     "timestamp":"2017-08-05T00:40:02.012Z",
20.     "source":"Sender Name <sender@example.com>",
21.     "sourceArn":"arn:aws:ses:us-east-1:123456789012:identity/sender@example.com",
22.     "sendingAccountId":"123456789012",
23.     "messageId":"EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
24.     "destination":[
25.       "recipient@example.com"
26.     ],
27.     "headersTruncated":false,
28.     "headers":[
29.       {
30.         "name":"From",
31.         "value":"Sender Name <sender@example.com>"
32.       },
33.       {
34.         "name":"To",
35.         "value":"recipient@example.com"
36.       },
37.       {
38.         "name":"Subject",
39.         "value":"Message sent from Amazon SES"
40.       },
41.       {
42.         "name":"MIME-Version",
43.         "value":"1.0"
44.       },
45.       {
46.         "name":"Content-Type",
47.         "value":"multipart/alternative; boundary=\"----=_Part_7307378_1629847660.1516840721503\""
48.       }
49.     ],
50.     "commonHeaders":{
51.       "from":[
52.         "Sender Name <sender@example.com>"
53.       ],
54.       "to":[
55.         "recipient@example.com"
56.       ],
57.       "messageId":"EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
58.       "subject":"Message sent from Amazon SES"
59.     },
60.     "tags":{
61.       "ses:configuration-set":[
62.         "ConfigSet"
63.       ],
64.       "ses:source-ip":[
65.         "192.0.2.0"
66.       ],
67.       "ses:from-domain":[
68.         "example.com"
69.       ],
70.       "ses:caller-identity":[
71.         "ses_user"
72.       ]
73.     }
74.   }
75. }
```

## 投诉记录
<a name="event-publishing-retrieving-sns-complaint"></a>

下面是 Amazon SES 发布到 Amazon SNS 的 `Complaint` 事件记录的一个示例。

```
 1. {
 2.   "eventType":"Complaint",
 3.   "complaint": {
 4.     "complainedRecipients":[
 5.       {
 6.         "emailAddress":"recipient@example.com"
 7.       }
 8.     ],
 9.     "timestamp":"2017-08-05T00:41:02.669Z",
10.     "feedbackId":"01000157c44f053b-61b59c11-9236-11e6-8f96-7be8aexample-000000",
11.     "userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36",
12.     "complaintFeedbackType":"abuse",
13.     "arrivalDate":"2017-08-05T00:41:02.669Z"
14.   },
15.   "mail":{
16.     "timestamp":"2017-08-05T00:40:01.123Z",
17.     "source":"Sender Name <sender@example.com>",
18.     "sourceArn":"arn:aws:ses:us-east-1:123456789012:identity/sender@example.com",
19.     "sendingAccountId":"123456789012",
20.     "messageId":"EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
21.     "destination":[
22.       "recipient@example.com"
23.     ],
24.     "headersTruncated":false,
25.     "headers":[
26.       {
27.         "name":"From",
28.         "value":"Sender Name <sender@example.com>"
29.       },
30.       {
31.         "name":"To",
32.         "value":"recipient@example.com"
33.       },
34.       {
35.         "name":"Subject",
36.         "value":"Message sent from Amazon SES"
37.       },
38.       {
39.         "name":"MIME-Version","value":"1.0"
40.       },
41.       {
42.         "name":"Content-Type",
43.         "value":"multipart/alternative; boundary=\"----=_Part_7298998_679725522.1516840859643\""
44.       }
45.     ],
46.     "commonHeaders":{
47.       "from":[
48.         "Sender Name <sender@example.com>"
49.       ],
50.       "to":[
51.         "recipient@example.com"
52.       ],
53.       "messageId":"EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
54.       "subject":"Message sent from Amazon SES"
55.     },
56.     "tags":{
57.       "ses:configuration-set":[
58.         "ConfigSet"
59.       ],
60.       "ses:source-ip":[
61.         "192.0.2.0"
62.       ],
63.       "ses:from-domain":[
64.         "example.com"
65.       ],
66.       "ses:caller-identity":[
67.         "ses_user"
68.       ]
69.     }
70.   }
71. }
```

## 送达记录
<a name="event-publishing-retrieving-sns-delivery"></a>

下面是 Amazon SES 发布到 Amazon SNS 的 `Delivery` 事件记录的一个示例。

```
 1. {
 2.   "eventType": "Delivery",
 3.   "mail": {
 4.     "timestamp": "2016-10-19T23:20:52.240Z",
 5.     "source": "sender@example.com",
 6.     "sourceArn": "arn:aws:ses:us-east-1:123456789012:identity/sender@example.com",
 7.     "sendingAccountId": "123456789012",
 8.     "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
 9.     "destination": [
10.       "recipient@example.com"
11.     ],
12.     "headersTruncated": false,
13.     "headers": [
14.       {
15.         "name": "From",
16.         "value": "sender@example.com"
17.       },
18.       {
19.         "name": "To",
20.         "value": "recipient@example.com"
21.       },
22.       {
23.         "name": "Subject",
24.         "value": "Message sent from Amazon SES"
25.       },
26.       {
27.         "name": "MIME-Version",
28.         "value": "1.0"
29.       },
30.       {
31.         "name": "Content-Type",
32.         "value": "text/html; charset=UTF-8"
33.       },
34.       {
35.         "name": "Content-Transfer-Encoding",
36.         "value": "7bit"
37.       }
38.     ],
39.     "commonHeaders": {
40.       "from": [
41.         "sender@example.com"
42.       ],
43.       "to": [
44.         "recipient@example.com"
45.       ],
46.       "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
47.       "subject": "Message sent from Amazon SES"
48.     },
49.     "tags": {
50.       "ses:configuration-set": [
51.         "ConfigSet"
52.       ],
53.       "ses:source-ip": [
54.         "192.0.2.0"
55.       ],
56.       "ses:from-domain": [
57.         "example.com"
58.       ],
59.       "ses:caller-identity": [
60.         "ses_user"
61.       ],
62.       "ses:outgoing-ip": [
63.         "192.0.2.0"
64.       ],
65.       "myCustomTag1": [
66.         "myCustomTagValue1"
67.       ],
68.       "myCustomTag2": [
69.         "myCustomTagValue2"
70.       ]      
71.     }
72.   },
73.   "delivery": {
74.     "timestamp": "2016-10-19T23:21:04.133Z",
75.     "processingTimeMillis": 11893,
76.     "recipients": [
77.       "recipient@example.com"
78.     ],
79.     "smtpResponse": "250 2.6.0 Message received",
80.     "remoteMtaIp": "123.456.789.012",
81.     "reportingMTA": "mta.example.com"
82.   }
83. }
```

## 发送记录
<a name="event-publishing-retrieving-sns-send"></a>

下面是 Amazon SES 发布到 Amazon SNS 的 `Send` 事件记录的一个示例。有些字段并不总是存在。例如，使用模板电子邮件，主题稍后会呈现并包含在后续活动中。

```
 1. {
 2.   "eventType": "Send",
 3.   "mail": {
 4.     "timestamp": "2016-10-14T05:02:16.645Z",
 5.     "source": "sender@example.com",
 6.     "sourceArn": "arn:aws:ses:us-east-1:123456789012:identity/sender@example.com",
 7.     "sendingAccountId": "123456789012",
 8.     "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
 9.     "destination": [
10.       "recipient@example.com"
11.     ],
12.     "headersTruncated": false,
13.     "headers": [
14.       {
15.         "name": "From",
16.         "value": "sender@example.com"
17.       },
18.       {
19.         "name": "To",
20.         "value": "recipient@example.com"
21.       },
22.       {
23.         "name": "Subject",
24.         "value": "Message sent from Amazon SES"
25.       },
26.       {
27.         "name": "MIME-Version",
28.         "value": "1.0"
29.       },
30.       {
31.         "name": "Content-Type",
32.         "value": "multipart/mixed;  boundary=\"----=_Part_0_716996660.1476421336341\""
33.       },
34.       {
35.         "name": "X-SES-MESSAGE-TAGS",
36.         "value": "myCustomTag1=myCustomTagValue1, myCustomTag2=myCustomTagValue2"
37.       }
38.     ],
39.     "commonHeaders": {
40.       "from": [
41.         "sender@example.com"
42.       ],
43.       "to": [
44.         "recipient@example.com"
45.       ],
46.       "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
47.       "subject": "Message sent from Amazon SES"
48.     },
49.     "tags": {
50.       "ses:configuration-set": [
51.         "ConfigSet"
52.       ],
53.       "ses:source-ip": [
54.         "192.0.2.0"
55.       ],
56.       "ses:from-domain": [
57.         "example.com"
58.       ],      
59.       "ses:caller-identity": [
60.         "ses_user"
61.       ],
62.       "myCustomTag1": [
63.         "myCustomTagValue1"
64.       ],
65.       "myCustomTag2": [
66.         "myCustomTagValue2"
67.       ]      
68.     }
69.   },
70.   "send": {}
71. }
```

## 拒绝记录
<a name="event-publishing-retrieving-sns-reject"></a>

下面是 Amazon SES 发布到 Amazon SNS 的 `Reject` 事件记录的一个示例。

```
 1. {
 2.   "eventType": "Reject",
 3.   "mail": {
 4.     "timestamp": "2016-10-14T17:38:15.211Z",
 5.     "source": "sender@example.com",
 6.     "sourceArn": "arn:aws:ses:us-east-1:123456789012:identity/sender@example.com",
 7.     "sendingAccountId": "123456789012",
 8.     "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
 9.     "destination": [
10.       "sender@example.com"
11.     ],
12.     "headersTruncated": false,
13.     "headers": [
14.       {
15.         "name": "From",
16.         "value": "sender@example.com"
17.       },
18.       {
19.         "name": "To",
20.         "value": "recipient@example.com"
21.       },      
22.       {
23.         "name": "Subject",
24.         "value": "Message sent from Amazon SES"
25.       },
26.       {
27.         "name": "MIME-Version",
28.         "value": "1.0"
29.       },      
30.       {
31.         "name": "Content-Type",
32.         "value": "multipart/mixed; boundary=\"qMm9M+Fa2AknHoGS\""
33.       },
34.       {
35.         "name": "X-SES-MESSAGE-TAGS",
36.         "value": "myCustomTag1=myCustomTagValue1, myCustomTag2=myCustomTagValue2"
37.       }  
38.     ],
39.     "commonHeaders": {
40.       "from": [
41.         "sender@example.com"
42.       ],
43.       "to": [
44.         "recipient@example.com"
45.       ],
46.       "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
47.       "subject": "Message sent from Amazon SES"
48.     },
49.     "tags": {
50.       "ses:configuration-set": [
51.         "ConfigSet"
52.       ],
53.       "ses:source-ip": [
54.         "192.0.2.0"
55.       ],
56.       "ses:from-domain": [
57.         "example.com"
58.       ],    
59.       "ses:caller-identity": [
60.         "ses_user"
61.       ],
62.       "myCustomTag1": [
63.         "myCustomTagValue1"
64.       ],
65.       "myCustomTag2": [
66.         "myCustomTagValue2"
67.       ]      
68.     }
69.   },
70.   "reject": {
71.     "reason": "Bad content"
72.   }
73. }
```

## 打开记录
<a name="event-publishing-retrieving-sns-open"></a>

下面是 Amazon SES 发布到 Amazon SNS 的 `Open` 事件记录的一个示例。

```
 1. {
 2.   "eventType": "Open",
 3.   "mail": {
 4.     "commonHeaders": {
 5.       "from": [
 6.         "sender@example.com"
 7.       ],
 8.       "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
 9.       "subject": "Message sent from Amazon SES",
10.       "to": [
11.         "recipient@example.com"
12.       ]
13.     },
14.     "destination": [
15.       "recipient@example.com"
16.     ],
17.     "headers": [
18.       {
19.         "name": "X-SES-CONFIGURATION-SET",
20.         "value": "ConfigSet"
21.       },
22.       {
23.         "name":"X-SES-MESSAGE-TAGS",
24.         "value":"myCustomTag1=myCustomValue1, myCustomTag2=myCustomValue2"
25.       },
26.       {
27.         "name": "From",
28.         "value": "sender@example.com"
29.       },
30.       {
31.         "name": "To",
32.         "value": "recipient@example.com"
33.       },
34.       {
35.         "name": "Subject",
36.         "value": "Message sent from Amazon SES"
37.       },
38.       {
39.         "name": "MIME-Version",
40.         "value": "1.0"
41.       },
42.       {
43.         "name": "Content-Type",
44.         "value": "multipart/alternative; boundary=\"XBoundary\""
45.       }
46.     ],
47.     "headersTruncated": false,
48.     "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
49.     "sendingAccountId": "123456789012",
50.     "source": "sender@example.com",
51.     "tags": {
52.       "myCustomTag1":[
53.         "myCustomValue1"
54.       ],
55.       "myCustomTag2":[
56.         "myCustomValue2"
57.       ],
58.       "ses:caller-identity": [
59.         "IAM_user_or_role_name"
60.       ],
61.       "ses:configuration-set": [
62.         "ConfigSet"
63.       ],
64.       "ses:from-domain": [
65.         "example.com"
66.       ],
67.       "ses:source-ip": [
68.         "192.0.2.0"
69.       ]
70.     },
71.     "timestamp": "2017-08-09T21:59:49.927Z"
72.   },
73.   "open": {
74.     "ipAddress": "192.0.2.1",
75.     "timestamp": "2017-08-09T22:00:19.652Z",
76.     "userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60"
77.   }
78. }
```

## 单击记录
<a name="event-publishing-retrieving-sns-click"></a>

下面是 Amazon SES 发布到 Amazon SNS 的 `Click` 事件记录的一个示例。

```
 1. {
 2.   "eventType": "Click",
 3.   "click": {
 4.     "ipAddress": "192.0.2.1",
 5.     "link": "http://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-smtp.html",
 6.     "linkTags": {
 7.       "samplekey0": [
 8.         "samplevalue0"
 9.       ],
10.       "samplekey1": [
11.         "samplevalue1"
12.       ]
13.     },
14.     "timestamp": "2017-08-09T23:51:25.570Z",
15.     "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36"
16.   },
17.   "mail": {
18.     "commonHeaders": {
19.       "from": [
20.         "sender@example.com"
21.       ],
22.       "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
23.       "subject": "Message sent from Amazon SES",
24.       "to": [
25.         "recipient@example.com"
26.       ]
27.     },
28.     "destination": [
29.       "recipient@example.com"
30.     ],
31.     "headers": [
32.       {
33.         "name": "X-SES-CONFIGURATION-SET",
34.         "value": "ConfigSet"
35.       },
36.       {
37.         "name":"X-SES-MESSAGE-TAGS",
38.         "value":"myCustomTag1=myCustomValue1, myCustomTag2=myCustomValue2"
39.       },
40.       {
41.         "name": "From",
42.         "value": "sender@example.com"
43.       },
44.       {
45.         "name": "To",
46.         "value": "recipient@example.com"
47.       },
48.       {
49.         "name": "Subject",
50.         "value": "Message sent from Amazon SES"
51.       },
52.       {
53.         "name": "MIME-Version",
54.         "value": "1.0"
55.       },
56.       {
57.         "name": "Content-Type",
58.         "value": "multipart/alternative; boundary=\"XBoundary\""
59.       },
60.       {
61.         "name": "Message-ID",
62.         "value": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000"
63.       }
64.     ],
65.     "headersTruncated": false,
66.     "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
67.     "sendingAccountId": "123456789012",
68.     "source": "sender@example.com",
69.     "tags": {
70.       "myCustomTag1":[
71.         "myCustomValue1"
72.       ],
73.       "myCustomTag2":[
74.         "myCustomValue2"
75.       ],
76.       "ses:caller-identity": [
77.         "ses_user"
78.       ],
79.       "ses:configuration-set": [
80.         "ConfigSet"
81.       ],
82.       "ses:from-domain": [
83.         "example.com"
84.       ],
85.       "ses:source-ip": [
86.         "192.0.2.0"
87.       ]
88.     },
89.     "timestamp": "2017-08-09T23:50:05.795Z"
90.   }
91. }
```

## 呈现失败记录
<a name="event-publishing-retrieving-sns-failure"></a>

下面是 Amazon SES 发布到 Amazon SNS 的 `Rendering Failure` 事件记录的一个示例。

```
 1. {
 2.   "eventType":"Rendering Failure",
 3.   "mail":{
 4.     "timestamp":"2018-01-22T18:43:06.197Z",
 5.     "source":"sender@example.com",
 6.     "sourceArn":"arn:aws:ses:us-east-1:123456789012:identity/sender@example.com",
 7.     "sendingAccountId":"123456789012",
 8.     "messageId":"EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
 9.     "destination":[
10.       "recipient@example.com"
11.     ],
12.     "headersTruncated":false,
13.     "tags":{
14.       "ses:configuration-set":[
15.         "ConfigSet"
16.       ]
17.     }
18.   },
19.   "failure":{
20.     "errorMessage":"Attribute 'attributeName' is not present in the rendering data.",
21.     "templateName":"MyTemplate"
22.   }
23. }
```

## DeliveryDelay 记录
<a name="event-publishing-retrieving-sns-delayed-delivery"></a>

下面是 Amazon SES 发布到 Amazon SNS 的 `DeliveryDelay` 事件记录的一个示例。

```
 1. {
 2.   "eventType": "DeliveryDelay",
 3.   "mail":{
 4.     "timestamp":"2020-06-16T00:15:40.641Z",
 5.     "source":"sender@example.com",
 6.     "sourceArn":"arn:aws:ses:us-east-1:123456789012:identity/sender@example.com",
 7.     "sendingAccountId":"123456789012",
 8.     "messageId":"EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
 9.     "destination":[
10.       "recipient@example.com"
11.     ],
12.     "headersTruncated":false,
13.     "tags":{
14.       "ses:configuration-set":[
15.         "ConfigSet"
16.       ]
17.     }
18.   },
19.   "deliveryDelay": {
20.     "timestamp": "2020-06-16T00:25:40.095Z",
21.     "delayType": "TransientCommunicationFailure",
22.     "expirationTime": "2020-06-16T00:25:40.914Z",
23.     "delayedRecipients": [{
24.       "emailAddress": "recipient@example.com",
25.       "status": "4.4.1",
26.       "diagnosticCode": "smtp; 421 4.4.1 Unable to connect to remote host"
27.     }]
28.   }
29. }
```

## 订阅记录
<a name="event-publishing-retrieving-sns-subscription"></a>

下面是 Amazon SES 发布到 Firehose 的 `Subscription` 事件记录的一个示例。

```
 1. {
 2.   "eventType": "Subscription",
 3.   "mail": {
 4.     "timestamp": "2022-01-12T01:00:14.340Z",
 5.     "source": "sender@example.com",
 6.     "sourceArn": "arn:aws:ses:us-east-1:123456789012:identity/sender@example.com",
 7.     "sendingAccountId": "123456789012",
 8.     "messageId": "EXAMPLEe4bccb684-777bc8de-afa7-4970-92b0-f515137b1497-000000",
 9.     "destination": ["recipient@example.com"],
10.     "headersTruncated": false,
11.     "headers": [
12.       {
13.         "name": "From",
14.         "value": "sender@example.com"
15.       },
16.       {
17.         "name": "To",
18.         "value": "recipient@example.com"
19.       },
20.       {
21.         "name": "Subject",
22.         "value": "Message sent from Amazon SES"
23.       },
24.       {
25.         "name": "MIME-Version",
26.         "value": "1.0"
27.       },
28.       {
29.         "name": "Content-Type",
30.         "value": "text/html; charset=UTF-8"
31.       },
32.       {
33.         "name": "Content-Transfer-Encoding",
34.         "value": "7bit"
35.       }
36.     ],
37.     "commonHeaders": {
38.       "from": ["sender@example.com"],
39.       "to": ["recipient@example.com"],
40.       "messageId": "EXAMPLEe4bccb684-777bc8de-afa7-4970-92b0-f515137b1497-000000",
41.       "subject": "Message sent from Amazon SES"
42.     },
43.     "tags": {
44.       "ses:operation": ["SendEmail"],
45.       "ses:configuration-set": ["ConfigSet"],
46.       "ses:source-ip": ["192.0.2.0"],
47.       "ses:from-domain": ["example.com"],
48.       "ses:caller-identity": ["ses_user"],
49.       "myCustomTag1": ["myCustomValue1"],
50.       "myCustomTag2": ["myCustomValue2"]
51.     }
52.   },
53.   "subscription": {
54.     "contactList": "ContactListName",
55.     "timestamp": "2022-01-12T01:00:17.910Z",
56.     "source": "UnsubscribeHeader",
57.     "newTopicPreferences": {
58.       "unsubscribeAll": true,
59.       "topicSubscriptionStatus": [
60.         {
61.           "topicName": "ExampleTopicName",
62.           "subscriptionStatus": "OptOut"
63.         }
64.       ]
65.     },
66.     "oldTopicPreferences": {
67.       "unsubscribeAll": false,
68.       "topicSubscriptionStatus": [
69.         {
70.           "topicName": "ExampleTopicName",
71.           "subscriptionStatus": "OptOut"
72.         }
73.       ]
74.     }
75.   }
76. }
```