

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

# 步驟 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。