

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 監控您的 Amazon SES 傳送活動
<a name="monitor-sending-activity"></a>

Amazon SES 會使用事件、指標和統計數字，提供監控您的傳送活動的方法。事件是指與您指定要以指標形式追蹤的傳送活動相關的事件。指標代表依照時間順序排列的一組資料點，這些資料點代表產生統計資料的受監控事件類型之值。統計數字是指在特定時間期間內 (包含截至目前為止) 的指標資料彙總。

這些監控方法可以協助您追蹤重要測量，例如帳戶的退信率、抱怨率與拒絕率等。過高的退信與抱怨率可能影響您使用 SES 傳送電子郵件的能力。透過協助您找出運用事件發佈以及與組態集關聯的自訂網域之整體開啟與依序點按比率的方式，這些方法也可用來測量客戶與您傳送的電子郵件互動的比率；請參閱 [設定自訂網域來處理開啟與點按追蹤](configure-custom-open-click-domains.md)。

設定監控的第一個步驟是找出與傳送活動相關的電子郵件事件類型，此為您要使用 SES 測量和監控的類型。您可以選擇下列事件類型以便於 SES 中監控：
+ **Send (傳送)** - 傳送請求成功，且 Amazon SES 會嘗試將訊息遞送到收件人的電子郵件伺服器。(如果正在使用帳戶層級或全域禁止，SES 仍會將其視為傳送，但會禁止遞送)。
+ **轉譯失敗** – 因範本轉譯問題而未傳送電子郵件。範本資料遺失或是範本參數與資料不相符時，可能會出現此事件類型。(只有使用 [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 成功將電子郵件交付給收件人的郵件伺服器。
+ **退信** – *硬退信*代表收件人的郵件伺服器永久拒絕電子郵件。（只有在 SES 不再嘗試傳送電子郵件時，才會包含*軟退信*。 一般而言，這些軟退信表示交付失敗，但在某些情況下，即使郵件成功到達收件人收件匣，也可以傳回軟退信。 這通常發生在收件人傳送out-of-office的自動回覆時。 在此 [AWS re：Post 文章](https://repost.aws/knowledge-center/ses-understand-soft-bounces)中進一步了解軟退信。)
+ **Complaint (投訴)** - 電子郵件已成功遞送至收件人的郵件伺服器，但收件人將其標示為垃圾郵件。
+ **交付延遲** – 因為發生暫時問題，所以無法將電子郵件遞送至收件人的郵件伺服器。例如，當收件人的收件匣已滿時，或接收電子郵件伺服器暫時發生問題時，可能會發生傳遞延遲。
+ **Subscription (訂閱)** - 已成功遞送電子郵件，但收件人透過按一下電子郵件標頭中的 `List-Unsubscribe` 或頁尾中的 `Unsubscribe` 連結來更新訂閱偏好設定。
+ **Open (開啟)** - 收件人收到訊息，並在其電子郵件用戶端中開啟。
+ **Click (點按)** - 收件人點按電子郵件中包含的一或多個連結。

您可以透過數種方式監控電子郵件傳送事件。您選擇的方法取決於您要監控的事件類型、您要監控事件的精細程度和詳細程度，以及您希望 SES 發佈資料的位置。您必須使用回饋通知或事件發佈來追蹤退信和抱怨事件。您也可以選擇使用多個監控方法。下表列出每種方法的特性。


| 監控方式 | 您可以監控的事件 | 存取資料的方法 | 細節層次 | 精細程度 | 
| --- | --- | --- | --- | --- | 
|  SES 主控台  |  帳戶運作狀態、已傳送的電子郵件、已使用的配額、順利傳送的請求、拒絕、退信和抱怨 *(最近的歷史記錄到目前評價)*  |  SES 主控台中的[帳戶儀表板頁面](monitor-sending-activity-console.md)   |  計數與百分比  |  整個 AWS 帳戶  | 
|  SES 主控台  |  帳戶運作狀態、已傳送的電子郵件、退信和抱怨 *(目前評價)*  |  SES 主控台中的[評價指標頁面](reputation-dashboard-dg.md)   |  僅結算率  |  整個 AWS 帳戶  | 
|  虛擬可交付性管理員  |  帳戶統計資料、ISP、傳送身分、組態設定、傳送、交付、投訴、暫時性和永久退信、開啟和點選、可交付性和評價。  |  [虛擬可交付性管理員儀表板](vdm-dashboard.md) 在 SES 主控台中 [虛擬可交付性管理員顧問](vdm-advisor.md) 在 SES 主控台中  |  計數與百分比  |  整個 AWS 帳戶  | 
|  SES API  |  交付、退信、投訴與拒收  |  [https://docs.aws.amazon.com/ses/latest/APIReference/API_GetSendStatistics.html](https://docs.aws.amazon.com/ses/latest/APIReference/API_GetSendStatistics.html)API 操作  |  僅計數  |  整個 AWS 帳戶  | 
|  Amazon CloudWatch 主控台  |  傳送、遞送、開啟、點按、退信、退信率、投訴、投訴率、拒絕、轉譯失敗和黑名單 IP。  |  CloudWatch 主控台  有些指標在直到相關聯的事件發生前都不會出現在 CloudWatch 中。例如，在您傳送的電子郵件中至少有一封遭到退信，或是您使用[信箱模擬器](send-an-email-from-console.md)產生模擬退信之前，退信指標都不會出現在 CloudWatch 中。   |  僅計數  |  整個 AWS 帳戶  | 
|  意見回饋通知  |  交付、退信與投訴  |  Amazon SNS 通知 (遞送、退信與投訴) 或電子郵件 (僅退信與投訴)。請參閱 [設定事件通知](monitor-sending-activity-using-notifications.md)。  |  每個事件的詳細資訊  |  整個 AWS 帳戶  | 
|  事件發佈  |  傳送、遞送、開啟、點選、退信、抱怨、拒絕和轉譯失敗。  |  Amazon CloudWatch 或 Amazon Data Firehose，或透過 Amazon SNS 通知 – 請參閱 [使用事件發佈監控電子郵件傳送](monitor-using-event-publishing.md)。 *（需支付額外費用，請參閱 [ CloudWatch 的每個指標價格](event-publishing-add-event-destination-cloudwatch.md#cw-add-pricing)。)*  |  每個事件的詳細資訊  |  微調 (根據使用者定義的電子郵件特性)  | 
|  運用與組態集關聯的自訂網域之事件發佈 - [更多資訊](configure-custom-open-click-domains.md)  |  開啟並按一下追蹤。  |  Amazon CloudWatch 或 Amazon Data Firehose，或透過 Amazon SNS 通知。 *（需支付額外費用，請參閱 [ CloudWatch 的每個指標價格](event-publishing-add-event-destination-cloudwatch.md#cw-add-pricing)。)*  |  每個事件的詳細資訊。  |  微調 (根據使用者定義的電子郵件特性)  | 

**注意**  
以電子郵件傳送事件計算的指標可能無法完全符合您的傳送配額。此差異可能是由電子郵件退信和拒絕，或使用 SES 收件匣模擬器造成。若要了解您與傳送配額間的距離，請參閱 [監控您的傳送配額](manage-sending-quotas-monitor.md)。

**Topics**
+ [使用 Amazon SES 主控台來監控您的傳送統計資料](monitor-sending-activity-console.md)
+ [使用 Amazon SES API 來監控您的用量統計資料](monitor-sending-activity-api.md)
+ [使用 Amazon SES 事件發佈監控電子郵件傳送](monitor-using-event-publishing.md)

# 使用 Amazon SES 主控台來監控您的傳送統計資料
<a name="monitor-sending-activity-console"></a>

從 Amazon SES 主控台的**帳戶儀表板**、**評價指標**和 **SMTP 設定**頁面，您可以監控您的所有電子郵件傳送、使用情況、統計數字、SMTP 設定、整體帳戶運作狀態以及評價指標。以下幾節說明上述主控台頁面提供的指標和統計資料。

應該注意的是，雖然 [帳户儀表板](#account-dashboard) 和 [評價指標](#reputation-metrics) 主控台頁面包含退信指標與投訴指標，但這兩組退信率與投訴率之間仍有細微的差別，如下所述：
+ **帳戶儀表板頁面** - 根據選取的日期範圍，您可以檢視過去的退信率和抱怨率，顯示了截至目前時間為止的變化指標進展。
+ **評價指標頁面** – 退信率和投訴率是基於在高水平計算您的整體歷史平均值時收到的最新資料點 (這不應該與您的常規退信/投訴率混淆，這對應於即時發生的精確的退信/投訴事件，如 **Account dashboard (帳戶儀表板)** 頁面上所示)。

作為比較 **Reputation metrics (評價指標)** 頁面和 **Account dashboard (帳戶儀表板)** 頁面之間的退信率或投訴率的簡單範例，假設昨天的比率為 2%，今天為 1%，在 **Reputation metrics (評價指標)** 頁面上，您僅會看見 1% 的當前比率，但在 **Account dashboard (帳戶儀表板)** 頁面上，圖表會繪製圖表的進展顯示了昨天的 2％ 和今天的 1％。

## 帳户儀表板
<a name="account-dashboard"></a>

您可以直接從 SES 主控台中 *Daily email usage (每日電子郵件用量)* 窗格的 **Account dashboard (帳戶儀表板)** 頁面，監控帳戶傳送的電子郵件數量和已使用傳送配額的百分比。帳户的交付率和拒絕率，以及以下窗格中與傳送電子郵件相關的其他關鍵因素，都可以在 *Sending Statistics (傳送統計資料)* 窗格中監控：
+ **傳送限制** – 包含以下適用於通過 SES 傳送郵件的配額：
  + *每日傳送份額* - 您在 24 小時內可傳送的電子郵件數量上限。
  + *最高傳送速率* - 每秒可從您的帳戶傳送的電子郵件數量上限。
+ **帳户運作狀態** – 您 SES 帳戶的狀態：
  + `Healthy` - 目前沒有影響您的帳戶評價相關問題。
  + `Under review` - 您的 SES 帳戶已發現潛在問題-您的帳戶正在檢閱您的帳戶，而您正在修正問題。
  + `Paused` - 由於從您的帳戶傳送的電子郵件中存在問題，您的帳戶暫停傳送電子郵件功能。當問題修正後，您可以申請恢復帳戶傳送電子郵件的功能。
+ **每日電子郵件使用** – 檢查您的每日使用情況，確保您不會接近您的傳送限制：
  + *傳送的電子郵件數量* - 在 24 小時內傳送的電子郵件總數量。
  + *剩餘傳送數* - 在 24 小時內可傳送的剩餘電子郵件總數量。
  + *已使用的傳送配額* - 已使用的每日傳送配額百分比。
+ **傳送統計數字** – 由圖形組成，這些圖形顯示了依照時間順序排列的一組資料點中四大基本指標的進展，這些資料點表示所選的資料範圍 (使用 *1 小時* 的彙總期間) 產生統計數字之受監控事件類型的值。您可以選取具有從 `Last 1 day` 至 `Last 14 days` 的開始值之資料範圍來篩選下方圖表：
  + *傳送數* - 所選日期區間成功的電子郵件傳送申請總和。
  + *拒絕* - 基於所選日期區間的 `Rejects/Sends * 100`，SES 拒絕傳送申請的平均速率。
  + *退信* - 從所選日期區間進度的整體歷史寄件者評價指標得出的平均比率。
  + *投訴* - 從所選日期區間進度的整體歷史寄件者評價指標得出的平均比率。

這些圖表中，每個都包含 **View in CloudWatch (在 CloudWatch 中檢視)** 按鈕，此按鈕可在 Amazon CloudWatch 主控台中開啟對應指標，允許檢視詳細資料、執行自訂指標數學運算，並且[在 CloudWatch 中建立警報](reputationdashboard-cloudwatch-alarm.md)。

## 評價指標
<a name="reputation-metrics"></a>

除了退信率和投訴率外，**Reputation metrics (評價指標)** 頁面可讓您看見影響您評價的關鍵因素概況，此頁面包含以下窗格：
+ **總結** - 提供您評價運作狀態的概觀。
  + *狀態* - 基於歷史退信和投訴率的整體評價運作狀態：
    + `Healthy` - 兩個指標均在正常等級內。
    + `Under review` - 一個或兩個指標自動造成您帳戶列入審核名單。
    + `At risk` - 一個或兩個指標已達到狀態不良等級，您的帳戶傳送電子郵件能力可能存在風險。
  + *傳送的電子郵件數量 (過去 24 小時)* — 在過去 24 小時內傳送的電子郵件總數量。
  + *剩餘傳送數* — 在 24 小時內可傳送的剩餘電子郵件總數量。
  + *已使用的傳送配額* — 已使用的每日傳送配額百分比。
+ ** 帳戶層級標籤內容：**
  + 退信率
    + *狀態* - 使用與總結窗格中描述的相同值表示退信率的運作狀態。
    + *歷史退信率* - 您帳戶中導致硬退信的電子郵件百分比，根據您的整體歷史平均值計算出來的典型傳送做法的代表性數量。
  + 投訴率
    + *狀態* - 使用與總結窗格中描述的相同值表示投訴率的運作狀態。
    + *歷史退信率* - 從您的帳戶傳送的電子郵件中造成收件人回報為垃圾郵件的百分比，該百分比根據您典型傳送做法的代表性數量計算出的總體歷史平均值計算。
+ **組態集標籤內容：**
  + 按組態集顯示的評價
    + *組態集* - 允許您輸入或選擇啟用評價指標的組態集，以便您可以根據使用所選組態集傳送的電子郵件查看總結、退信和投訴數據。選擇組態集後出現的結果窗格與上述評價指標頁面中所述的窗格相同，不同之處在於它們僅基於所選組態集傳送的電子郵件，與您的整體帳戶層級傳送指標並列。

## SMTP 設定
<a name="smtp-settings"></a>

本頁列出透過 SES API 或程式設計方式使用 Amazon SES SMTP 界面所需的 SMTP 設定，並提供建立和管理 SMTP 憑證的連結：
+ **SMTP 設置** – 如果您想要使用支援 SMTP 的程式設計語言、電子郵件伺服器或應用程式以連接 Amazon SES SMTP 界面，提供下列資訊：
  + SMTP 端點
  + STARTTLS 連接
  + Transport Layer Security (TLS)
  + TLS Wrapper 連接
  + 為建立和管理 SMTP 和 IAM 憑證提供的身分驗證連結

## 使用控制台監控傳送和評價指標
<a name="console-stats-metrics"></a>

以下程序將幫助您開始瀏覽您的傳送和評價指標：使用 **Account dashboard (帳戶儀表板)** 頁面的最近歷史記錄(最長 14 天)，或使用 **Reputation metrics (評價指標)** 頁面查看基於您截至當前時間的整體歷史記錄的指標。

**如果檢視已傳送的電子郵件及使用的傳送配額**

1. 登入 AWS 管理主控台 ，並在 [https://console.aws.amazon.com/ses/](https://console.aws.amazon.com/ses/)：// 開啟 Amazon SES 主控台。

1. 在導覽窗格中，選擇 **Account dashboard (帳戶儀表板)**。您的用量統計數字會顯示在 **Daily email usage** (每日電子郵件用量) 中。

**若要檢視傳送計數、拒絕率、退信率和抱怨率**

1. 在導覽窗格中，選擇 **Account dashboard (帳戶儀表板)**。

1. 在 **Sending statistics** (傳送統計數字) 區段中，使用 **Date range** (日期範圍) 下拉式選單來選取日期範圍的開始值，以便直接篩選 **Sending statistics** (傳送統計數字) 區段下的四大圖表。

1. 根據選取的日期範圍，您可以檢視過去的計數和比率，顯示了截至目前時間為止的變化指標進展。

1. 在任何圖表中，選擇 **View in CloudWatch** (在 CloudWatch 中檢視) 按鈕，以便於 **Amazon CloudWatch** 主控台中開啟對應的指標，您可以主控台中檢視詳細資料、執行自訂指標數學運算，並且[在 CloudWatch 中建立監控警示](reputationdashboard-cloudwatch-alarm.md)。

**若要檢視整體歷史退信與投訴率**

1. 在導覽窗格中，選擇 **Reputation Metrics (評價指標)**。

1. 在 **Bounce rate (退信率)** 窗格中，您可以查看從您的帳戶傳送的電子郵件中造成硬退信的百分比。在 **Complaint rate (投訴率)** 窗格中，您可以查看從您的帳戶傳送的電子郵件中造成收件人回報為垃圾郵件的百分比。這兩項指標是根據您的典型傳送作法算出的代表性數量。

1. 在任何窗格中，選擇 **View in CloudWatch (在 CloudWatch 中檢視)** 按鈕，以便於 **Amazon CloudWatch** 主控台中開啟對應的指標，您可以主控台中檢視詳細資料、執行自訂指標數學運算，並且[在 CloudWatch 中建立監控警示](reputationdashboard-cloudwatch-alarm.md)。

**若要按組態集查看評價指標**

1. 在導覽窗格中，選擇 **Reputation Metrics (評價指標)**。

1. 在評價指標頁面上，選擇 **Configuration set (組態集)** 標籤。

1. 在 **Reputation by configuration set (按組態集顯示的評價)** 窗格中，按一下 **Configuration set (組態集)** 欄位，然後開始輸入或選擇已啟用評價指標的組態集。

1. 選擇組態集後，將載入總結、退信和投訴窗格，顯示僅基於選定組態集傳送的電子郵件的指標。

# 使用 Amazon SES API 來監控您的用量統計資料
<a name="monitor-sending-activity-api"></a>

Amazon SES API 提供 `GetSendStatistics` 作業，可傳回關於服務用量的資訊。我們建議您定期檢查您的傳送統計資料，以便視需要進行調整。

當您呼叫 `GetSendStatistics` 操作時將收到資料點清單，顯示在過去兩週內的傳送活動。在此清單中的每個資料點代表 15 分鐘的活動，且包含該期間內的下列資訊：
+ 硬退信數量
+ 投訴數量
+ 傳遞嘗試次數 (對應您已寄出的電子郵件數量)
+ 傳送嘗試遭拒的數量
+ 分析期間的時間戳記

如需關於 `GetSendStatistics` 作業的完整說明，請參閱 [Amazon Simple Email Service API 參考資料](https://docs.aws.amazon.com/ses/latest/APIReference/GetSendStatistics.html)。

在本節中，您將可找到下列主題：
+ [使用 呼叫 `GetSendStatistics` API 操作 AWS CLI](#monitor-sending-activity-api-cli)
+ [以程式設計方式呼叫 `GetSendStatistics` 操作](#monitor-sending-activity-api-sdk)

## 使用 呼叫 `GetSendStatistics` API 操作 AWS CLI
<a name="monitor-sending-activity-api-cli"></a>

呼叫 `GetSendStatistics` API 操作最簡單的方式是使用 [AWS Command Line Interface](https://aws.amazon.com/cli) (AWS CLI)。

**使用 呼叫 `GetSendStatistics` API 操作 AWS CLI**

1. 若您尚未安裝 AWS CLI，請先完成安裝。如需詳細資訊，請參閱*AWS Command Line Interface 《 使用者指南*》中的「[安裝 AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/installing.html) 」。

1. 如果您尚未這麼做，請將 AWS CLI 設定為使用您的登入資料 AWS 。如需詳細資訊，請參閱*AWS Command Line Interface 《 使用者指南*》中的「[設定 AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html)」。

1. 在命令列中執行以下命令：

   ```
   aws ses get-send-statistics
   ```

   如果 AWS CLI 設定正確，您會看到 JSON 格式的傳送統計資料清單。每個 JSON 物件包含在 15 分鐘期間內的彙總傳送統計資料。

## 以程式設計方式呼叫 `GetSendStatistics` 操作
<a name="monitor-sending-activity-api-sdk"></a>

您也可以使用 AWS SDKs呼叫 `GetSendStatistics`操作。本節包含 Go、PHP、Python 和 Ruby AWS SDKs 程式碼範例。選擇下列其中一個連結，以檢視該語言的程式碼範例：
+ [適用於 Go 的 AWS SDK程式碼範例](#code-example-getsendstatistics-golang)
+ [適用於 PHP 的 AWS SDK程式碼範例](#code-example-getsendstatistics-php)
+ [適用於 Python (Boto) 的 AWS SDK程式碼範例](#code-example-getsendstatistics-python)
+ [適用於 Ruby 的 AWS SDK程式碼範例](#code-example-getsendstatistics-ruby)

**注意**  
這些程式碼範例假設您已建立 AWS 共用的登入資料檔案，其中包含您的 AWS 存取金鑰 ID、 AWS 私密存取金鑰，以及您偏好的 AWS 區域。如需詳細資訊，請參閱[共用憑證與組態檔案](https://docs.aws.amazon.com/credref/latest/refdocs/creds-config-files.html)。

### `GetSendStatistics` 使用 呼叫 適用於 Go 的 AWS SDK
<a name="code-example-getsendstatistics-golang"></a>

```
 1. package main
 2.     
 3. import (
 4.     "fmt"
 5.     
 6.     //go get github.com/aws/aws-sdk-go/...
 7.     "github.com/aws/aws-sdk-go/aws"
 8.     "github.com/aws/aws-sdk-go/aws/session"
 9.     "github.com/aws/aws-sdk-go/service/ses"
10.     "github.com/aws/aws-sdk-go/aws/awserr"
11. )
12.     
13. const (
14.     // Replace us-west-2 with the AWS Region you're using for Amazon SES.
15.     AwsRegion = "us-west-2"
16. )
17.     
18. func main() {
19.     
20.     // Create a new session and specify an AWS Region.
21.     sess, err := session.NewSession(&aws.Config{
22.         Region:aws.String(AwsRegion)},
23.     )
24.     
25.     // Create an SES client in the session.
26.     svc := ses.New(sess)
27.     input := &ses.GetSendStatisticsInput{}
28.     
29.     result, err := svc.GetSendStatistics(input)
30.     
31.     // Display error messages if they occur.
32.     if err != nil {
33.         if aerr, ok := err.(awserr.Error); ok {
34.             switch aerr.Code() {
35.             default:
36.                 fmt.Println(aerr.Error())
37.             }
38.         } else {
39.             // Print the error, cast err to awserr.Error to get the Code and
40.             // Message from an error.
41.             fmt.Println(err.Error())
42.         }
43.         return
44.     }
45.     
46.     fmt.Println(result)
47. }
```

### `GetSendStatistics` 使用 呼叫 適用於 PHP 的 AWS SDK
<a name="code-example-getsendstatistics-php"></a>

```
 1. <?php
 2. 
 3. // Replace path_to_sdk_inclusion with the path to the SDK as described in 
 4. // http://docs.aws.amazon.com/aws-sdk-php/v3/guide/getting-started/basic-usage.html
 5. define('REQUIRED_FILE','path_to_sdk_inclusion');
 6.                                                   
 7. // Replace us-west-2 with the AWS Region you're using for Amazon SES.
 8. define('REGION','us-west-2'); 
 9. 
10. require REQUIRED_FILE;
11. 
12. use Aws\Ses\SesClient;
13. 
14. $client = SesClient::factory(array(
15.     'version'=> 'latest',     
16.     'region' => REGION
17. ));
18. 
19. try {
20.      $result = $client->getSendStatistics([]);
21. 	 echo($result);
22. } catch (Exception $e) {
23.      echo($e->getMessage()."\n");
24. }
25. 
26. ?>
```

### `GetSendStatistics` 使用 呼叫 適用於 Python (Boto) 的 AWS SDK
<a name="code-example-getsendstatistics-python"></a>

```
 1. import boto3 #pip install boto3
 2. import json
 3. from botocore.exceptions import ClientError
 4. 
 5. client = boto3.client('ses')
 6. 
 7. try:
 8.     response = client.get_send_statistics(
 9. )
10. except ClientError as e:
11.     print(e.response['Error']['Message'])
12. else:
13.     print(json.dumps(response, indent=4, sort_keys=True, default=str))
```

### `GetSendStatistics` 使用 呼叫 適用於 Ruby 的 AWS SDK
<a name="code-example-getsendstatistics-ruby"></a>

```
 1. require 'aws-sdk' # gem install aws-sdk
 2. require 'json'
 3. 
 4. # Replace us-west-2 with the AWS Region you're using for Amazon SES.
 5. awsregion = "us-west-2"
 6. 
 7. # Create a new SES resource and specify a region
 8. ses = Aws::SES::Client.new(region: awsregion)
 9. 
10. begin
11. 
12.   resp = ses.get_send_statistics({
13.   })
14.   puts JSON.pretty_generate(resp.to_h)
15. 
16. # If something goes wrong, display an error message.
17. rescue Aws::SES::Errors::ServiceError => error
18.   puts error
19. 
20. end
```

# 使用 Amazon SES 事件發佈監控電子郵件傳送
<a name="monitor-using-event-publishing"></a>

若要讓您精細追蹤電子郵件傳送，您可以設定 Amazon SES，根據您定義的特性，將*電子郵件傳送事件*發佈至 Amazon CloudWatch、Amazon Data Firehose、Amazon Pinpoint、Amazon Simple Notification Service 或 Amazon EventBridge。

您可以追蹤數種類型的電子郵件傳送事件，包括傳送、交付、開啟、點選、退信、抱怨、拒收、算圖失敗和傳遞延遲。此資訊用於操作性與分析性用途時可能有幫助。例如，您可以將電子郵件傳送資料發佈至 CloudWatch，並建立可追蹤電子郵件行銷活動表現的儀表板，或者使用 Amazon SNS 以在特定事件發生時向您傳送通知。

## 事件發佈如何與組態集和訊息標籤搭配使用
<a name="event-publishing-how-works"></a>

若要使用事件發佈，您必須先設定一或多個*組態集*。組態設定將指定發佈事件的位置以及要發佈哪些事件。接著，每次傳送電子郵件時，您需要提供組態集名稱以及一或多個*訊息標籤*，以名稱值對的格式來分類電子郵件。例如，若您要宣傳書籍，可以在傳送相關行銷活動的電子郵件時，將訊息標籤命名為*類型*，並指定*科幻*或*西部*的值。

視您使用的電子郵件傳送界面而定，您可以將訊息標籤做為參數提供給 [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)。如需組態集的詳細資訊，請參閱 [使用 Amazon SES 中的組態集](using-configuration-sets.md)。

除了您指定的訊息標籤之外，SES 也會將*自動標籤*新增至您傳送的訊息。您不需要執行任何額外的步驟，就能使用自動標籤。

下表列出自動套用至您使用 SES 傳送之訊息的自動標籤。


**SES 自動標籤**  

| 自動名稱標籤 | Description | 
| --- | --- | 
| 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* 和靜態標籤 *AmazonSES* 組成，將 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)。

您也可以在 Amazon 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 仍會將其視為傳送，但會禁止遞送)。
+ **轉譯失敗** – 因範本轉譯問題而未傳送電子郵件。範本資料遺失或是範本參數與資料不相符時，可能會出現此事件類型。(只有使用 [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 成功將電子郵件交付給收件人的郵件伺服器。
+ **退信** – *硬退信*代表收件人的郵件伺服器永久拒絕電子郵件。（只有在 SES 不再嘗試傳送電子郵件時，才會包含*軟退信*。 一般而言，這些軟退信表示交付失敗，但在某些情況下，即使郵件成功到達收件人收件匣，也可以傳回軟退信。 這通常發生在收件人傳送out-of-office的自動回覆時。 在此 [AWS re：Post 文章](https://repost.aws/knowledge-center/ses-understand-soft-bounces)中進一步了解軟退信。)
+ **Complaint (投訴)** - 電子郵件已成功遞送至收件人的郵件伺服器，但收件人將其標示為垃圾郵件。
+ **交付延遲** – 因為發生暫時問題，所以無法將電子郵件遞送至收件人的郵件伺服器。例如，當收件人的收件匣已滿時，或接收電子郵件伺服器暫時發生問題時，可能會發生傳遞延遲。
+ **Subscription (訂閱)** - 已成功遞送電子郵件，但收件人透過按一下電子郵件標頭中的 `List-Unsubscribe` 或頁尾中的 `Unsubscribe` 連結來更新訂閱偏好設定。
+ **Open (開啟)** - 收件人收到訊息，並在其電子郵件用戶端中開啟。
+ **Click (點按)** - 收件人點按電子郵件中包含的一或多個連結。

**組態集**  
一組規則，定義 SES 發佈電子郵件傳送事件的目標，以及您要發佈的電子郵件傳送事件類型。當您傳送想要使用事件發佈的電子郵件時，需指定與該電子郵件相關的組態設定。

**事件目的地**  
您發佈 SES 電子郵件傳送事件的目標 AWS 服務。您所設定的每個事件目的地皆僅屬於一個且是唯一的組態設定。

**訊息標籤**  
您根據事件發佈用途來分類電子郵件的名稱/值組。範例包括*行銷活動/書籍*和*行銷活動/衣物*。當您傳送電子郵件時，您可以將訊息標籤指定為 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 Notification Service (Amazon SNS)

下列主題涵蓋設定事件發佈所需的下列步驟：

1. 您必須使用 Amazon SES 主控台或 API 來建立*組態集*。

1. 將一或多個*事件目的地* (CloudWatch、Firehose、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 Notification Service (Amazon SNS)

您選擇的事件目的地取決於您所需的事件相關詳細資訊程度，以及您想要接收事件資訊的方法。如果您只想要每種事件的計算加總 (例如，可用於設定總數過高時的警示)，可以使用 CloudWatch。

如果您想要可以輸出到其他服務的詳細事件記錄，例如 Amazon OpenSearch Service 或 Amazon 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>

有 [Amazon 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 維度是一組用來唯一辨識指標的名稱/值組。

例如，您可能有一個訊稱為 `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 事件目的地詳細資訊到組態集，並假設您已完成 [建立事件目的地](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) 作業來建立和修改事件目的地。

**若要使用主控台將 CloudWatch 事件目的地詳細資訊新增到組態集**

1. 以下是有關選擇 CloudWatch 作為您的事件目的地類型的詳細說明，請參閱 [步驟 7](event-destinations-manage.md#specify-event-dest-step)，並假定您已完成 [建立事件目的地](event-destinations-manage.md#event-destination-add) 中的先前步驟。選取 CloudWatch **目的地類型**、輸入目的地**名稱**並啟用**事件發佈**後，會顯示 **Amazon CloudWatch 維度**窗格，其欄位會在下列步驟中處理。*（需支付額外費用，請參閱 [ CloudWatch 的每個指標價格](#cw-add-pricing)。)* 

1. 針對 **Value Source (值來源)**，指定 Amazon SES 如何取得要傳遞給 CloudWatch 的資料。可使用以下值來源：
   + **Message Tag (訊息標籤)** - 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) 和破折號 (-)。不可使用空格、重音字元、非 Latin 字元和其他特殊字元。

1. 針對 **Default Value (預設值)**，輸入維度的值。
**注意**  
維度值只能包含 ASCII 字母 (a-z、A-Z)、數字 (0-9)、底線 (\$1)、破折號 (-)、@ 符號 (@) 和句號 (.)。不可使用空格、重音字元、非 Latin 字元和其他特殊字元。

1. 如果您希望新增更多維度，請選擇 **Add Dimension (新增維度)**。否則請選擇 **Next (下一步)**。/

1. 在審核畫面上，如果您對定義活動目的地的方式感到滿意，請選擇 **Add destination (新增目的地)**。

## 選擇 CloudWatch 維度
<a name="event-publishing-add-event-destination-cloudwatch-dimensions"></a>

當您選擇名稱和值做為 CloudWatch 維度使用時，請考慮以下因素：
+ **每個指標的價格** - 您可以在 CloudWatch 中免費檢視基本 Amazon SES 指標。不過，當您使用事件發佈收集指標時，會產生 [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 的呼叫來根據標題值收集指標，便可使用此選項。如果您使用自己的 MIME 訊息標頭進行 Amazon SES 事件發佈，您用於 Amazon SES 事件發佈的標頭名稱和值，僅可包含字母 A 到 Z、數字 0 到 9、底線 (\$1)、@ 符號、連字號 (-) 和句號 (.)。如果您指定的標頭名稱或數值包含其他字元，電子郵件傳送呼叫仍會成功執行，但事件指標不會傳送至 Amazon CloudWatch。

如需 CloudWatch 概念的詳細資訊，請參閱 [Amazon CloudWatch 使用者指南](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html)中的 *Amazon CloudWatch 概念*。

# 為 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 事件目的地詳細資訊新增至組態設定，並假設您已完成 中的步驟 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) 作業來建立和更新事件目的地。

**使用主控台將 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. 在審核畫面上，如果您對定義活動目的地的方式感到滿意，請選擇 **Add destination (新增目的地)**。

如需如何使用 `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"
            ]
        }
    ]
}
```

------

在上述範例政策中進行下列變更：
+ 將*交付區域*取代為您建立 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"
        }
      }
    }
  ]
}
```

------

在上述範例政策中進行下列變更：
+ 將*交付區域*取代為您建立 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 EventBridge 監控 SES 事件](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)。選取 *Amazon EventBridge* **目的地類型**、輸入目的地**名稱**並啟用**事件發佈**後，會顯示 **Amazon EventBridge 事件匯流排**資訊窗格。

1. 選擇**下一步**。

1. 在審核畫面上，如果您對定義活動目的地的方式感到滿意，請選擇 **Add destination (新增目的地)**。這會開啟活動目的地的摘要頁面，其中的成功橫幅將確認您的活動目的地是否已成功建立或修改。

# 為事件發佈設定 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. 以下是有關選擇 Amazon Pinpoint 作為您的活動目的地類型的詳細說明，請參閱[步驟 7](event-destinations-manage.md#specify-event-dest-step)，並假設您已在 [建立事件目的地](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. 在審核畫面上，如果您對定義活動目的地的方式感到滿意，請選擇 **Add destination (新增目的地)**。這會開啟活動目的地的摘要頁面，其中的成功橫幅將確認您的活動目的地是否已成功建立或修改。

# 為事件發佈設定 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. 以下是有關選擇 Amazon SNS 作為您的活動目的地類型的詳細說明，請參閱 [步驟 7](event-destinations-manage.md#specify-event-dest-step)，並假設您已在 [建立事件目的地](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. 在審核畫面上，如果您對定義活動目的地的方式感到滿意，請選擇 **Add destination (新增目的地)**。這會開啟活動目的地的摘要頁面，其中的成功橫幅將確認您的活動目的地是否已成功建立或修改。

1. 無論您建立新的 SNS 主題還是選取現有主題，都必須授予 SES 的存取權，才能將通知發佈至主題。在上一步的事件目的地摘要頁面上，從 **Destination type** (目的地類型) 一欄中選擇 **Amazon SNS** - 您將前往 Amazon Simple Notification Service 主控台中的 **Topics** (主題) 清單 - *從 Amazon SNS 主控台執行下列步驟：*

   1. 選取您在上一步建立或修改的 SNS 主題名稱。

   1. 在主題的詳細資訊畫面中，選擇 **Edit** (編輯)。

   1. 若要授予 SES 將通知發佈到主題的許可，請在 SNS 主控台的 **Edit topic** (編輯主題) 畫面中，展開 **Access policy** (存取政策)，並在 **JSON editor** (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](https://docs.aws.amazon.com/ses/latest/APIReference/API_SendBulkTemplatedEmail.html)、[SendCustomVerificationEmail](https://docs.aws.amazon.com/ses/latest/APIReference/API_SendCustomVerificationEmail.html) 或 [SendRawEmail](https://docs.aws.amazon.com/ses/latest/APIReference/API_SendRawEmail.html) 搭配事件發佈，請將稱為 [ConfigurationSet](https://docs.aws.amazon.com/ses/latest/APIReference/API_ConfigurationSet.html) 與 [MessageTag](https://docs.aws.amazon.com/ses/latest/APIReference/API_MessageTag.html) 的資料結構傳遞至 API 呼叫，以指定組態集與訊息標籤。

如需使用 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 的標頭名稱或值，電子郵件傳送呼叫仍會成功執行，但事件指標將不會發送至 Amazon CloudWatch。

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

在您[設定事件發佈](monitor-sending-using-event-publishing-setup.md)並為傳送電子郵件指定組態設定後，您可以從您在設定與電子郵件相關聯的組態設定時所指定的事件目標擷取電子郵件傳送事件。

本節說明如何從 Amazon CloudWatch 和 Amazon Data Firehose 擷取您的電子郵件傳送事件，以及如何解譯 Amazon SNS 提供的事件資料。
+ [從 CloudWatch 擷取 Amazon SES 事件資料](event-publishing-retrieving-cloudwatch.md)
+ [從 Firehose 擷取 Amazon SES 事件資料](event-publishing-retrieving-firehose.md)
+ [解譯 Amazon SNS 提供的 Amazon SES 事件資料](event-publishing-retrieving-sns.md)

# 從 CloudWatch 擷取 Amazon SES 事件資料
<a name="event-publishing-retrieving-cloudwatch"></a>

Amazon SES 可以將電子郵件傳送事件的指標發佈到 Amazon CloudWatch。發佈事件資料至 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 自動提供的[自動標籤](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 仍會將其視為傳送，但會禁止遞送)。
+ **轉譯失敗** – 因範本轉譯問題而未傳送電子郵件。範本資料遺失或是範本參數與資料不相符時，可能會出現此事件類型。(只有使用 [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 成功將電子郵件交付給收件人的郵件伺服器。
+ **退信** – *硬退信*代表收件人的郵件伺服器永久拒絕電子郵件。（只有在 SES 不再嘗試傳送電子郵件時，才會包含*軟退信*。 一般而言，這些軟退信表示交付失敗，但在某些情況下，即使郵件成功到達收件人收件匣，也可以傳回軟退信。 這通常發生在收件人傳送out-of-office的自動回覆時。 在此 [AWS re：Post 文章](https://repost.aws/knowledge-center/ses-understand-soft-bounces)中進一步了解軟退信。)
+ **Complaint (投訴)** - 電子郵件已成功遞送至收件人的郵件伺服器，但收件人將其標示為垃圾郵件。
+ **交付延遲** – 因為發生暫時問題，所以無法將電子郵件遞送至收件人的郵件伺服器。例如，當收件人的收件匣已滿時，或接收電子郵件伺服器暫時發生問題時，可能會發生傳遞延遲。
+ **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 管理主控台 並開啟位於 https：//[https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/) 的 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 會將電子郵件傳送事件發佈至 Firehose 做為 JSON 記錄。接著 Firehose 會將記錄發佈到您在 Firehose 中設定交付串流時所選擇的 AWS 服務目的地。如需有關設定 Firehose 交付串流的資訊，請參閱[《Amazon Data Firehose 開發人員指南》中的建立 Firehose 交付串流](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 物件包含下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `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 物件有下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `timestamp`  |  傳送訊息的日期和時間，格式為 ISO8601 (*YYYY-MM-DDThh:mm:ss.sZ*)。  | 
|  `messageId`  |  Amazon SES 指派給訊息的專有 ID。您傳送訊息後，Amazon SES 會回傳此數值給您。  此訊息 ID 是由 Amazon SES 指派。您可以在原始電子郵件內 `headers` 物件的 `commonHeaders` 與 `mail` 欄位找到訊息 ID。   | 
|  `source`  |  傳送出該訊息的電子郵件地址 (信封的「寄件人」地址)。  | 
|  `sourceArn`  |  用以傳送電子郵件之身分的 Amazon Resource Name (ARN)。在傳送授權的情況下，`sourceArn` 為身分持有者授權給委託寄件者之身分的 ARN，用以傳送電子郵件。如需關於傳送授權的詳細資訊，請參閱 [電子郵件身分驗證方法使用傳送授權](sending-authorization.md)。  | 
|  `sendingAccountId`  |  用來傳送電子郵件之帳戶的帳戶 AWS ID。在傳送授權的情況下，`sendingAccountId` 為委託寄件者的帳戶 ID。  | 
|  `destination`  |  原始郵件收件人的電子郵件地址清單。  | 
|  `headersTruncated`  |  說明通知中的標題是否已截斷的字串，會在標題大於 10 KB 時顯示。可能值為 `true` 和 `false`。  | 
|  `headers`  |  電子郵件原始標題的清單。清單中的每項標題都有 `name` 欄位與 `value` 欄位。  `headers` 欄位中的任何訊息 ID 都來自於您傳遞給 Amazon SES 的原始訊息。Amazon SES 隨即指派給訊息的訊息 ID 位於 `mail` 物件的 `messageId` 欄位內。   | 
|  `commonHeaders`  |  電子郵件常用的原始標頭映射。  任何 `commonHeaders` 欄位內的訊息 ID 皆為 Amazon SES 隨即指派給訊息的訊息 ID，位於 `mail` 物件的 `messageId` 欄位內。   | 
|  `tags`  |  與電子郵件相關聯的標籤清單。  | 

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

其中包含關於 `Bounce` 事件的 JSON 物件將會有下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `bounceType`  |  退信類型，由 Amazon SES 判定。  | 
|  `bounceSubType`  |  退信的副類型，由 Amazon SES 判定。  | 
|  `bouncedRecipients`  |  其中包含遭退信的原始郵件收件人之相關資訊的清單。  | 
|  `timestamp`  |  ISP 傳送退信通知時的日期和時間，其格式為 ISO8601 格式 (*YYYY-MM-DDThh:mm:ss.sZ*)。  | 
|  `feedbackId`  |  退信的唯一 ID。  | 
|  `reportingMTA`  |  來自 DSN 的 `Reporting-MTA` 欄位數值。這是嘗試執行傳遞、轉傳或閘道操作的 Message Transfer Authority (MTA) 值，如 DSN 中所述。  此欄位只有在傳遞狀態通知 (DSN) 與退信連接時才會顯示。   | 

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

退信事件可能與單一收件人或多個收件人相關。`bouncedRecipients` 欄位擁有物件清單 (每個收件人與退信事件相關的每個物件皆有一個清單)，且將一律包含下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `emailAddress`  |  收件人的電子郵件地址。若有可用的 DSN，此為來自 DSN 的 `Final-Recipient` 欄位值。  | 

或者，如果 DSN 連接到退信，也可能會顯示下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `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` 的退信時，您應該從電子清單中移除對應的電子郵件地址，您將來無法再傳送給他們。當訊息發生多次軟退信時，您會收到 `Transient` 退信，而 Amazon SES 會停止嘗試重新遞送該訊息。未來您也許可以成功重新傳送給一開始導致 `Transient` 退信的地址。


| bounceType | bounceSubType | Description | 
| --- | --- | --- | 
|  `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 物件有下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `complainedRecipients`  |  清單中包含可能曾提出投訴的收件人相關資訊。  | 
|  `timestamp`  |  ISP 傳送抱怨通知時的日期和時間，其格式為 ISO8601 格式 (*YYYY-MM-DDThh: mm: ss.sZ*)。  | 
|  `feedbackId`  |  投訴的唯一 ID。  | 
|  `complaintSubType`  |  投訴的子類型，由 Amazon SES 判定。  | 

此外，如果意見回饋報告連接到該投訴，可能顯示下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `userAgent`  |  來自意見回饋報告的 `User-Agent` 欄位數值。這表示產生報告的系統名稱和版本。  | 
|  `complaintFeedbackType`  |  自 ISP 傳送的意見回饋報告中的 `Feedback-Type` 欄位數值。這包含意見回饋的類型。  | 
|  `arrivalDate`  |  來自回饋報告的 `Arrival-Date` 或 `Received-Date` 欄位值，其格式為 ISO8601 格式 (*YYYY-MM-DDThh:mm:ss.sZ*)。此欄位可能不會在報告中顯示 (因而也不會在 JSON 中顯示)。  | 

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

`complainedRecipients` 欄位包含可能曾提出抱怨的收件人清單。

**重要**  
由於大部分 ISP 都會在投訴通知中編輯曾提出投訴的收件人電子郵件，此清單包含關於可能曾傳送投訴的收件人資訊，根據原始訊息與向我們發出投訴的 ISP 之收件人而產生。Amazon SES 將針對原始訊息執行查詢，以判斷此收件人清單。

在這個清單中的 JSON 物件包含下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `emailAddress`  |  收件人的電子郵件地址。  | 

### 抱怨類型
<a name="event-publishing-retrieving-firehose-contents-complaint-types"></a>

您可能看到 `complaintFeedbackType` 欄位中由回報 ISP 根據 [Internet Assigned Numbers Authority website](https://www.iana.org/assignments/marf-parameters/marf-parameters.xml#marf-parameters-2) 指派的下列投訴類型：


| 欄位名稱 | Description | 
| --- | --- | 
|  `abuse`  |  指出自動發出的電子郵件或其他形式的電子郵件濫用。  | 
|  `auth-failure`  |  電子郵件身分驗證故障報告。  | 
|  `fraud`  |  指示某些形式的詐騙或網路釣魚活動。  | 
|  `not-spam`  |  指示提供報告的實體不會將訊息視為垃圾郵件。這可能會用於修正內含不正確標籤或者被歸類為垃圾郵件的訊息。  | 
|  `other`  |  指示不符合其他註冊類型的任何其他意見回饋。  | 
|  `virus`  |  回報在原始訊息中找到病毒。  | 

## 交付物件
<a name="event-publishing-retrieving-firehose-contents-delivery-object"></a>

其中包含關於 `Delivery` 事件的 JSON 物件將會有下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `timestamp`  |  Amazon SES 傳遞電子郵件到收件人的郵件伺服器之日期和時間，以 ISO8601 格式 (*YYYY-MM-DDThh:mm:ss.sZ*) 顯示。  | 
|  `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 物件將會有下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `reason`  |  電子郵件遭拒的原因。唯一可能的值為 `Bad content`，這表示 Amazon SES 偵測到電子郵件包含病毒。當訊息遭到拒絕時，Amazon SES 會停止處理訊息，且不會嘗試將它遞送到收件人的電子郵件伺服器。  | 

## 開啟物件
<a name="event-publishing-retrieving-firehose-contents-open-object"></a>

其中包含關於 `Open` 事件的 JSON 物件將會包含下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `ipAddress`  |  收件人的 IP 地址。  | 
|  `timestamp`  |  開啟事件發生時的日期和時間，其格式為 ISO8601 格式 (*YYYY-MM-DDThh:mm:ss.sZ*)。  | 
|  `userAgent`  |  收件人用於開啟電子郵件中的連結的裝置或電子郵件用戶端使用者代理程式。  | 

## 點選物件
<a name="event-publishing-retrieving-firehose-contents-click-object"></a>

其中包含關於 `Click` 事件的 JSON 物件將會包含下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `ipAddress`  |  收件人的 IP 地址。  | 
|  `timestamp`  |  點擊事件發生時的日期和時間，其格式為 ISO8601 格式 (*YYYY-MM-DDThh:mm:ss.sZ*)。  | 
|  `userAgent`  |  收件人用於點選電子郵件中的連結的用戶端使用者代理程式。  | 
|  `link`  |  收件人點選的 URL 連結。  | 
|  `linkTags`  |  使用 `ses:tags` 屬性新增到連結的標籤清單。如需新增標籤至電子郵件中連結的相關資訊，請參閱 [問題 5：我可以使用獨特的識別碼來標籤連結嗎？](faqs-metrics.md#sending-metric-faqs-clicks-q5) 中的 [Amazon SES 電子郵件傳送指標常見問答集](faqs-metrics.md)。  | 

## 算圖失敗物件
<a name="event-publishing-retrieving-firehose-contents-failure-object"></a>

其中包含 `Rendering Failure` 事件相關資訊的 JSON 物件有下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `templateName`  |  用於傳送電子郵件的範本名稱。  | 
|  `errorMessage`  |  提供更多關於轉譯失敗資訊的訊息。  | 

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

其中包含 `DeliveryDelay` 事件相關資訊的 JSON 物件有下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `delayType`  |  延遲的類型。可能值為： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/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` 物件包含下列數值：


| 欄位名稱 | Description | 
| --- | --- | 
|  `emailAddress`  |  導致訊息傳遞延遲的電子郵件地址。  | 
|  `status`  |  與傳遞延遲相關聯的 SMTP 狀態碼。  | 
|  `diagnosticCode`  |  接收訊息傳輸代理程式 (MTA) 所提供的診斷代碼。  | 

## 訂閱物件
<a name="event-publishing-retrieving-firehose-subscription-object"></a>

其中包含 `Subscription` 事件相關資訊的 JSON 物件有下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `contactList`  |  聯絡人名稱清單為開啟。  | 
|  `timestamp`  |  ISP 傳送訂閱通知時的日期和時間，其格式為 ISO8601 格式 *(YYYY-MM-DDThh:mm:ss.sZ)*。  | 
|  `source`  |  傳送出該訊息的電子郵件地址 (信封的「寄件人」地址)。  | 
|  `newTopicPreferences`  |  JSON 資料結構 (映射) 指定聯絡清單中所有主題的訂閱狀態，顯示更改後的狀態 (已訂閱或已取消訂閱)。  | 
|  `oldTopicPreferences`  |  JSON 資料結構 (映射) 指定聯絡清單中所有主題的訂閱狀態，顯示更改前的狀態 (已訂閱或已取消訂閱)。  | 

### 新/舊主題偏好
<a name="event-publishing-retrieving-firehose-contents-subscription-object-topic-preferences"></a>

`newTopicPreferences` 和 `oldTopicPreferences` 物件包含下列數值：


| 欄位名稱 | Description | 
| --- | --- | 
|  `unsubscribeAll`  |  指定聯絡人是否取消聯絡清單中的所有主題。  | 
|  `topicSubscriptionStatus`  |  在 `topicName` 欄位中指定主題的訂閱狀態，指出主題目前是否訂閱接收來自指定事件類型的 SES 通知。可能的值為 `subscriptionStatus` 欄位中的 **OptIn** （已訂閱） 或 **OptOut** （未訂閱）。  | 
|  `topicDefaultSubscriptionStatus`  |  在 `topicName` 欄位中指定主題的預設訂閱狀態，以判斷新增至事件目的地的新主題是否預設訂閱或取消訂閱。在 `subscriptionStatus` 欄位中，可能的值為 **OptIn** （預設訂閱） 或 **OptOut** （預設取消訂閱）。  | 

# 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 物件包含下列欄位。事件類型會決定有哪些其他物件。


| 欄位名稱 | Description | 
| --- | --- | 
|  `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 物件有下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `timestamp`  |  傳送訊息的日期和時間，格式為 ISO8601 (*YYYY-MM-DDThh:mm:ss.sZ*)。  | 
|  `messageId`  |  Amazon SES 指派給訊息的專有 ID。您傳送訊息後，Amazon SES 會回傳此數值給您。  此訊息 ID 是由 Amazon SES 指派。您可以在原始電子郵件內 `headers` 物件的 `commonHeaders` 與 `mail` 欄位找到訊息 ID。   | 
|  `source`  |  傳送出該訊息的電子郵件地址 (信封的「寄件人」地址)。  | 
|  `sourceArn`  |  用以傳送電子郵件之身分的 Amazon Resource Name (ARN)。在傳送授權的情況下，`sourceArn` 為身分持有者授權給委託寄件者之身分的 ARN，用以傳送電子郵件。如需關於傳送授權的詳細資訊，請參閱 [電子郵件身分驗證方法使用傳送授權](sending-authorization.md)。  | 
|  `sendingAccountId`  |  用於傳送電子郵件之帳戶的帳戶 AWS ID。在傳送授權的情況下，`sendingAccountId` 為委託寄件者的帳戶 ID。  | 
|  `destination`  |  原始郵件收件人的電子郵件地址清單。  | 
|  `headersTruncated`  |  說明通知中的標題是否已截斷的字串，會在標題大於 10 KB 時顯示。可能值為 `true` 和 `false`。  | 
|  `headers`  |  電子郵件原始標題的清單。清單中的每項標題都有 `name` 欄位與 `value` 欄位。  `headers` 欄位中的任何訊息 ID 都來自於您傳遞給 Amazon SES 的原始訊息。Amazon SES 隨即指派給訊息的訊息 ID 位於 `mail` 物件的 `messageId` 欄位內。   | 
|  `commonHeaders`  |  電子郵件常用的原始標頭映射。  任何 `commonHeaders` 欄位內的訊息 ID 皆為 Amazon SES 隨即指派給訊息的訊息 ID，位於 `mail` 物件的 `messageId` 欄位內。   | 
|  `tags`  |  與電子郵件相關聯的標籤清單。  | 

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

其中包含 `Bounce` 事件相關資訊的 JSON 物件有下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `bounceType`  |  退信類型，由 Amazon SES 判定。  | 
|  `bounceSubType`  |  退信的副類型，由 Amazon SES 判定。  | 
|  `bouncedRecipients`  |  其中包含遭退信的原始郵件收件人之相關資訊的清單。  | 
|  `timestamp`  |  ISP 傳送退信通知時的日期和時間，其格式為 ISO8601 格式 (*YYYY-MM-DDThh:mm:ss.sZ*)。  | 
|  `feedbackId`  |  退信的唯一 ID。  | 
|  `reportingMTA`  |  來自 DSN 的 `Reporting-MTA` 欄位數值。這是嘗試執行傳遞、轉傳或閘道操作的 Message Transfer Authority (MTA) 值，如 DSN 中所述。  此欄位只有在傳遞狀態通知 (DSN) 與退信連接時才會顯示。   | 

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

退信事件可能與單一收件人或多個收件人相關。`bouncedRecipients` 欄位擁有物件清單 (電子郵件地址發生退信的每個收件人都有一個物件)，且包含下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `emailAddress`  |  收件人的電子郵件地址。若有可用的 DSN，此為來自 DSN 的 `Final-Recipient` 欄位值。  | 

或者，如果 DSN 連接到退信，也可能會顯示下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `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` 的退信時，您應該從電子清單中移除對應的電子郵件地址，您將來無法再傳送給他們。當訊息發生多次軟退信時，您會收到 `Transient` 退信，而 Amazon SES 會停止嘗試重新遞送該訊息。未來您也許可以成功重新傳送給一開始導致 `Transient` 退信的地址。


| bounceType | bounceSubType | Description | 
| --- | --- | --- | 
|  `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 物件有下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `complainedRecipients`  |  清單中包含可能曾提出投訴的收件人相關資訊。  | 
|  `timestamp`  |  ISP 傳送抱怨通知時的日期和時間，其格式為 ISO8601 格式 (*YYYY-MM-DDThh: mm: ss.sZ*)。  | 
|  `feedbackId`  |  投訴的唯一 ID。  | 
|  `complaintSubType`  |  投訴的子類型，由 Amazon SES 判定。  | 

此外，如果意見回饋報告連接到該投訴，可能顯示下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `userAgent`  |  來自意見回饋報告的 `User-Agent` 欄位數值。這表示產生報告的系統名稱和版本。  | 
|  `complaintFeedbackType`  |  自 ISP 傳送的意見回饋報告中的 `Feedback-Type` 欄位數值。這包含意見回饋的類型。  | 
|  `arrivalDate`  |  來自回饋報告的 `Arrival-Date` 或 `Received-Date` 欄位值，其格式為 ISO8601 格式 (*YYYY-MM-DDThh:mm:ss.sZ*)。此欄位可能不會在報告中顯示 (因而也不會在 JSON 中顯示)。  | 

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

`complainedRecipients` 欄位包含可能曾提出投訴的收件人清單。

**重要**  
大多數 ISP 會修改提出抱怨的收件人之電子郵件地址。因此，`complainedRecipients` 欄位將包含曾收過電子郵件、且地址位於發出抱怨通知的網域內之所有地址的清單。

在這個清單中的 JSON 物件包含下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `emailAddress`  |  收件人的電子郵件地址。  | 

### 抱怨類型
<a name="event-publishing-retrieving-sns-contents-complaint-types"></a>

您可能看到 `complaintFeedbackType` 欄位中由回報 ISP 根據 [Internet Assigned Numbers Authority website](https://www.iana.org/assignments/marf-parameters/marf-parameters.xml#marf-parameters-2) 指派的下列投訴類型：


| 欄位名稱 | Description | 
| --- | --- | 
|  `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 物件有下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `timestamp`  |  Amazon SES 傳遞電子郵件到收件人的郵件伺服器之日期和時間，以 ISO8601 格式 (*YYYY-MM-DDThh:mm:ss.sZ*) 顯示。  | 
|  `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 物件有下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `reason`  |  電子郵件遭拒的原因。唯一可能的值為 `Bad content`，這表示 Amazon SES 偵測到電子郵件包含病毒。當訊息遭到拒絕時，Amazon SES 會停止處理訊息，且不會嘗試將它遞送到收件人的電子郵件伺服器。  | 

## 開啟物件
<a name="event-publishing-retrieving-sns-contents-open-object"></a>

其中包含 `Open` 事件相關資訊的 JSON 物件有下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `ipAddress`  |  收件人的 IP 地址。  | 
|  `timestamp`  |  開啟事件發生時的日期和時間，其格式為 ISO8601 格式 (*YYYY-MM-DDThh:mm:ss.sZ*)。  | 
|  `userAgent`  |  收件人用於開啟電子郵件中的連結的裝置或電子郵件用戶端使用者代理程式。  | 

## 點選物件
<a name="event-publishing-retrieving-sns-contents-click-object"></a>

其中包含 `Click` 事件相關資訊的 JSON 物件有下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `ipAddress`  |  收件人的 IP 地址。  | 
|  `timestamp`  |  點擊事件發生時的日期和時間，其格式為 ISO8601 格式 (*YYYY-MM-DDThh:mm:ss.sZ*)。  | 
|  `userAgent`  |  收件人用於點選電子郵件中的連結的用戶端使用者代理程式。  | 
|  `link`  |  收件人點選的 URL 連結。  | 
|  `linkTags`  |  使用 `ses:tags` 屬性新增到連結的標籤清單。如需新增標籤至電子郵件中連結的相關資訊，請參閱 [問題 5：我可以使用獨特的識別碼來標籤連結嗎？](faqs-metrics.md#sending-metric-faqs-clicks-q5) 中的 [Amazon SES 電子郵件傳送指標常見問答集](faqs-metrics.md)。  | 

## 算圖失敗物件
<a name="event-publishing-retrieving-sns-contents-failure-object"></a>

其中包含 `Rendering Failure` 事件相關資訊的 JSON 物件有下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `templateName`  |  用於傳送電子郵件的範本名稱。  | 
|  `errorMessage`  |  提供更多關於轉譯失敗資訊的訊息。  | 

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

其中包含 `DeliveryDelay` 事件相關資訊的 JSON 物件有下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `delayType`  |  延遲的類型。可能值為： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/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` 物件包含下列數值：


| 欄位名稱 | Description | 
| --- | --- | 
|  `emailAddress`  |  導致訊息傳遞延遲的電子郵件地址。  | 
|  `status`  |  與傳遞延遲相關聯的 SMTP 狀態碼。  | 
|  `diagnosticCode`  |  接收訊息傳輸代理程式 (MTA) 所提供的診斷代碼。  | 

## 訂閱物件
<a name="event-publishing-retrieving-sns-contents-subscription-object"></a>

其中包含 `Subscription` 事件相關資訊的 JSON 物件有下列欄位。


| 欄位名稱 | Description | 
| --- | --- | 
|  `contactList`  |  聯絡人名稱清單為開啟。  | 
|  `timestamp`  |  ISP 傳送訂閱通知時的日期和時間，其格式為 ISO8601 格式 *(YYYY-MM-DDThh:mm:ss.sZ)*。  | 
|  `source`  |  傳送出該訊息的電子郵件地址 (信封的「寄件人」地址)。  | 
|  `newTopicPreferences`  |  JSON 資料結構 (映射) 指定聯絡清單中所有主題的訂閱狀態，顯示更改後的狀態 (已訂閱或已取消訂閱)。  | 
|  `oldTopicPreferences`  |  JSON 資料結構 (映射) 指定聯絡清單中所有主題的訂閱狀態，顯示更改前的狀態 (已訂閱或已取消訂閱)。  | 

### 新/舊主題偏好
<a name="event-publishing-retrieving-sns-contents-subscription-object-topic-preferences"></a>

`newTopicPreferences` 和 `oldTopicPreferences` 物件包含下列數值：


| 欄位名稱 | Description | 
| --- | --- | 
|  `unsubscribeAll`  |  指定聯絡人是否取消聯絡清單中的所有主題。  | 
|  `topicSubscriptionStatus`  |  在 `topicName` 欄位中指定主題的訂閱狀態，指出主題目前是否訂閱接收來自指定事件類型的 SES 通知。可能的值為 `subscriptionStatus` 欄位中的 **OptIn** （已訂閱） 或 **OptOut** （未訂閱）。  | 
|  `topicDefaultSubscriptionStatus`  |  在 `topicName` 欄位中指定主題的預設訂閱狀態，以判斷新增至事件目的地的新主題是否預設訂閱或取消訂閱。在 `subscriptionStatus` 欄位中，可能的值為 **OptIn** （預設訂閱） 或 **OptOut** （預設取消訂閱）。  | 

# 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. }
```