IBM Cloud Docs
使用Event Notifications SMTP 介面

使用Event Notifications SMTP 介面

IBM Cloud Event Notifications支援 SMTP(網際網路上最常見的電子郵件協定)。 您可以透過連接到支援 SMTP 的各種用戶端、軟體或程式語言來傳送電子郵件IBM Cloud Event NotificationsSMTP 介面。 本文檔介紹如何設定 SMTP 設定、取得使用者憑證以及設定 CBR 規則來存取 SMTP 伺服器。

網域名稱驗證

在中建立 SMTP 配置後IBM Cloud Event Notifications例如,您需要執行三種類型的驗證才能取得透過 SMTP 介面傳送電子郵件所需的參數。 這些驗證位於「驗證」標籤下,可透過按一下 功能表來存取。

  1. 建立寄件者政策架構 (SPF),用來驗證電子郵件的寄件者。 SPF 指定容許傳送網域電子郵件的郵件伺服器。

    • 確保該網域已作為 A 記錄存在於 DNS 記錄中。
    • 開啟已配置網域名稱的 DNS 管理提供者
    • 建立新的 TXT 記錄,並以 SPF 配置畫面中提供的名稱和值來登錄您的網域名稱
  2. 建立 DomainKeys Identified Mail (DKIM),它允許組織透過簽署來承擔傳送訊息的責任。 DKIM 允許接收方檢查聲稱來自特定網域的電子郵件是否已獲得該網域所有者的授權。

    • 開啟已配置網域名稱的 DNS 管理提供者
    • 使用網域名稱登錄者來建立新的 TXT 記錄,並使用 DKIM 的配置畫面中提供的名稱和值
  3. 為了加強安全,我們使用下列問卷手動驗證 SMTP 介面需求:

    1. Will the nature of the email content be Marketing or Transactional?
    
    2. What is your website's URL?
    
    3. Explain how you plan to use IBM Cloud Event Notifications to send email. To help us process your request, you should answer the following questions:
    
    a. What is your strategy for creating or obtaining your email subscriber list?
    
    b. What is your approach to managing bounced emails and handling recipient complaints?
    
    c. What methods do you have in place for recipients to unsubscribe from your email communications?
    
    d. How did you determine the sending rate or quota specified in your request?
    
    e. Are you regularly cleaning your email list to remove invalid or outdated email addresses?
    
    4. Indicate the email addresses where you wish to receive account-related communications. You can provide a list of up to four email addresses, separated by commas.
    
    5. In the Event Notifications subscription, you are asked to provide a Reply-To field. Confirm that this is a valid email-id with a mailbox.
    
    6. Include a statement affirming your commitment to sending emails only to individuals who have explicitly requested them, and verify that you have established a procedure for managing bounce and complaint notifications.
    
    7. Whether you have a manual or automated process in place for handling unsubscribes, it's important to provide an "unsubscribe" link in the email payload you send. When recipients decide not to receive further emails, they can simply click on the 'unsubscribe' link and remove their email address from your mailing list. Add a statement that you agree to have an “unsubscribe” link in the email payload that you send.
    
    8. If you send the html content in the notification payload, do you have a process to validate this content is well formatted? Ill formatted HTML content may descrese the server reputation.
    

    雖然許多問題是不言而喻的,但我們為少數人提供了解釋,以確保澄清。

    • 提供電子郵件的本質: 行銷或交易式。

      • 行銷電子郵件: 這些電子郵件會配送給廣泛的讀者,以行銷及促銷內容 (例如鼓勵購買或下載資訊) 的潛在客戶或客戶清單為目標。
      • 交易式電子郵件: 這些電子郵件針對每一個收件者進行個人化,通常由特定使用者動作觸發,例如進行網站購買或要求密碼重設。
    • 需要網站 URL 才能更清楚地了解您要發送的內容類型。

    • 需要有效的「回覆電子郵件 ID」,才能接收已拒絕或退件電子郵件的相關資訊。

    • 需要妥善格式化的電子郵件內容,以防止電子郵件在收件者結束時被分類為垃圾郵件。 格式不完整 (例如,不是 HTML 格式) 的電子郵件可能會導致「電子郵件服務提供者」將電子郵件分類為垃圾郵件。

    在填寫上述問題的回答時,使用者必須透過「支援問題單」要求啟用 SMTP 介面 Event Notifications 驗證:

    1. 從 IBM Cloud 主控台功能表列,按一下 說明 圖示> 支援中心
    2. 從「聯絡支援」區段中,按一下 建立案例
    3. Category 下選取,Topic 作為 Event Notifications,Subtopic 作為「其他」
    4. Subject add Requesting for the Authorization for Enable SMTP Interface for Event Notifications下
    5. 在「描述」部分先提供IBM Cloud Event Notificationsinstance id,region 在哪個實例中創建,以及 DKIM Name 其格式為 {{uuid}}._domainkey.{{domain}}
    6. 稍後,請包括對上述問題單的答覆。
    7. 如果您想要提供更多支援您回答的證明,請新增 附件
    8. 監看清單 區段中新增必要的電子郵件 ID。 若要在建立支援案例時進一步瞭解其他選項,請參閱 這裡

一些共同的核查問題可以是:

  1. 確保網域名稱拼寫正確。
  2. 驗證網域的 DNS 記錄已正確更新,包括 SPF/DKIM 值。
  3. DNS 的傳播可能需要 72 小時才能在網際網路上更新。

值得注意的是,我們對所提供網域的 SPF 及 DKIM TXT 記錄執行定期檢查。 為了確保電子郵件遞送不中斷,我們建議即使在驗證記錄一次之後,仍將記錄保持插入 DNS 中。 如果 SPF 或 DKIM 在定期檢查中失敗,我們將暫停電子郵件傳送。

啟用基於上下文的限制來存取 SMTP 介面

SMTP 介面的舊版基於 IP 的白名單現已棄用。 連接到 SMTP 介面時,必須遷移到基於上下文的限制。 目前列入白名單的 IP 將在接下來的六個月內保持功能,為此過渡留出時間。

預設情況下,任何 IP 位址都會限制對 SMTP 介面的存取。 若要允許存取 SMTP 接口,您必須啟用 基於上下文的限制。 特別是要存取 SMTP 接口,您必須選擇 API 類型為 SMTP 配置 在設定CBR規則時。

設定 CBR 規則時所選的網路區域中關聯的所有 IP 集將自動列入白名單,以連接到 SMTP 伺服器。

必須為以下內容設定 CBR 規則IBM Cloud Event Notifications您打算用於 SMTP 介面功能的實例

透過 SMTP 介面傳送電子郵件的需求

成功驗證 SMTP 配置後IBM Cloud Event Notifications例如,要使用 SMTP 介面傳送電子郵件,您需要以下參數:

  1. 下表提到了每個區域的IBM Cloud Event Notifications SMTP 端點清單:

    IBM Cloud Event NotificationsSMTP 端點
    Event Notifications 實例區域 SMTP 公共端點 SMTP 專用端點
    us-south (Dallas) smtp.us-south.event-notifications.cloud.ibm.com private.smtp.us-south.event-notifications.cloud.ibm.com
    卡托爾(多倫多) smtp.us-south.event-notifications.cloud.ibm.com private.smtp.us-south.event-notifications.cloud.ibm.com
    日本東京(東京) smtp.us-south.event-notifications.cloud.ibm.com private.smtp.us-south.event-notifications.cloud.ibm.com
    jp-osa(大阪) smtp.us-south.event-notifications.cloud.ibm.com private.smtp.us-south.event-notifications.cloud.ibm.com
    au-syd (雪梨) smtp.us-south.event-notifications.cloud.ibm.com private.smtp.us-south.event-notifications.cloud.ibm.com
    eu-gb (倫敦) smtp.us-south.event-notifications.cloud.ibm.com private.smtp.us-south.event-notifications.cloud.ibm.com
    eu-de (法蘭克福) smtp.eu-de.event-notifications.cloud.ibm.com private.smtp.eu-de.event-notifications.cloud.ibm.com
    eu-es (馬德里) smtp.eu-de.event-notifications.cloud.ibm.com private.smtp.eu-de.event-notifications.cloud.ibm.com
    br-sao (聖保羅) smtp.us-south.event-notifications.cloud.ibm.com private.smtp.us-south.event-notifications.cloud.ibm.com
    ca-mon (蒙特婁) smtp.us-south.event-notifications.cloud.ibm.com private.smtp.us-south.event-notifications.cloud.ibm.com

    SMTP 端點在下列區域可用:us-southeu-de。 例如,可以將其視為在倫敦和雪梨創建的實例也連接到達拉斯 SMTP 端點,在馬德里創建的實例也連接到法蘭克福 SMTP 端點。

  2. SMTP 介面埠號。 目前支援的埠 587。

  3. SMTP 使用者名稱和密碼。 使用者名稱和密碼在 SMTP 配置中是唯一的,並且密碼使用單向雜湊進行加密。 在單一 SMTP 配置中最多可以建立 5 個使用者。 我們目前支援來自 SMTP 通訊協定的 LoginPlain 鑑別方法。

  4. IBM Cloud Event NotificationsSMTP 介面目前支援透過以下方式連接 StartTLS 一種透過網路安全傳輸資料的方法。

  5. 用戶端軟體或程式可以嚴格使用「傳輸層安全 (TLS)」進行通訊。

  6. 可以提供用戶端連接至 SMTP 介面的有效 IP 位址或子網路。

  7. 訪問時IBM Cloud Event Notifications透過 SMTP 介面,您的 SMTP 用戶端應用程式將組裝訊息。 您需要提供的資訊可能會有所不同,具體取決於您使用的應用程式。 以下是用戶端與伺服器之間 SMTP 交換的最低需求:

    • 來源位址:來源位址必須屬於配置的網域;否則,寄件者地址將被拒絕。
    • 目的地位址: 目的地位址可以是任何有效的電子郵件位址或電子郵件位址集
    • 訊息資料: 確定訊息資料沒有垃圾郵件、乾淨且可感應。
  8. 下面提及基於 SMTP 端點的送出 IP 位址清單。 這些 IP 將列在接收者的電子郵件用戶端上:

    IBM Cloud Event Notifications傳出 IP 位址
    SMTP 端點 送出的 IP 位址
    smtp.us-south.event-notifications.cloud.ibm.com 150.240.68.207, 52.118.103.220, 169.47.95.114, 169.59.33.169, 150.239.167.120, 52.118.185.176
    smtp.eu-de.event-notifications.cloud.ibm.com 149.81.218.203, 158.177.6.24, 149.81.39.14, 158.176.12.194, 149.81.164.10, 161.156.160.31
  9. 根據現行配置,在 Event Notifications SMTP 介面中不支援附件。

使用 SMTP 介面傳送電子郵件

  1. 配置支援 SMTP 的軟體,包括ServiceNow, Jira、部落格平台、RSS 聚合器、清單管理軟體和工作流程系統,使用提供的 SMTP 端點、連接埠和有效的使用者名稱密碼憑證。

  2. 若要使用 SMTP 介面來傳送電子郵件,您可以使用啟用 SMTP 的程式設計語言、電子郵件伺服器或應用程式。 確保您完成上述所有必要步驟,並擁有正確的 SMTP 端點、連接埠和憑證來連接到IBM Cloud Event NotificationsSMTP 介面。

  3. 如果您目前管理自己的電子郵件伺服器,則可以使用 IBM Cloud SMTP 端點、埠及認證,透過 Event Notifications SMTP 配置來傳送所有外寄電子郵件,而無需修改現有的電子郵件用戶端及應用程式。

  4. 與IBM Cloud Event Notifications使用命令行的 SMTP 接口,請遵循以下範例:

    openssl s_client -starttls smtp -connect {{smtp_endpoint}}:587
    ...
    ...
    ...
    auth login
    334 VXNlcm5hbWU6
    dXNlcm5hbWU=
    334 UGFzc3dvcmQ6
    cGFzc3dvcmQ=
    235 2.7.0 Authentication successful
    mail from: mailer@example.com
    250 2.1.0 Ok
    rcpt to: recipient@test.com
    250 2.1.5 Ok
    data
    354 End data with <CR><LF>.<CR><LF>
    from: Mailer <mailer@example.com>
    to: Recipient <recipent@test.com>
    Subject: IBM Cloud Event Notifications SMTP interface
    Get the all events securely from IBM EN SMTP Interface
    .
    

使用 SMTP 專用端點傳送電子郵件

  1. 若要透過 SMTP 專用端點傳送電子郵件,您需要建立虛擬專用端點 (VPE) 或將其附加到IBM Cloud Virtual Private Cloud (VPC)。

  2. 確保將 VPE 閘道連接到部署 IKS ( IBM Kubernetes Service ) 叢集或 VSI(虛擬服務執行個體)的相同 VPC。

  3. 建立 VPE 時:

    1. 選擇您想要連接到 SMTP 專用終端節點的所需區域和 VPC。
    2. 在「請求連線至服務」下,選取 Event Notifications.
    3. 啟用端點:private.smtp.<region>.event-notifications.cloud.ibm.com
    4. 選擇保留 IP 所需的子網路(注意:每個 VPC 區域只能將一個 IP 位址綁定到終端節點閘道)。

    SMTP 專用端點 VPE
    SMTP 專用端點 VPE

  4. 基於上下文的限制 (CBR) 中為您的 VPC 建立網路區域

  5. 事件****通知實例建立 CBR 規則並新增上面建立的網路區域(或)將上面的網路區域新增至您已為事件通知實例建立的現有 CBR 規則

  6. 嘗試使用 此處 列出的對應 SMTP 專用端點。

追蹤電子郵件狀態

  • 從上述任何方法傳送電子郵件之後,您會收到佇列 ID,這將有助於除錯目的。
  • 此功能可讓使用者監視透過自訂電子郵件目的地傳送之電子郵件的遞送狀態,以確保透通性並加強整體使用者體驗。 如需相關資訊,請遵循 這些步驟