The documentation you are viewing is for Dapr v1.5 which is an older version of Dapr. For up-to-date documentation, see the latest version.

SMTP binding spec

Detailed documentation on the SMTP binding component

配置

To setup SMTP binding create a component of type bindings.smtp. 请参阅本指南,了解如何创建和应用绑定配置。

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: smtp
  namespace: default
spec:
  type: bindings.smtp
  version: v1
  metadata:
  - name: host
    value: "smtp host"
  - name: port
    value: "smtp port"
  - name: user
    value: "username"
  - name: password
    value: "password"
  - name: skipTLSVerify
    value: true|false
  - name: emailFrom
    value: "sender@example.com"
  - name: emailTo
    value: "receiver@example.com"
  - name: emailCC
    value: "cc@example.com"
  - name: emailBCC
    value: "bcc@example.com"
  - name: subject
    value: "subject"
  - name: priority
    value: "[value 1-5]"

元数据字段规范

字段 必填 绑定支持 详情 示例
host Y 输出 The host where your SMTP server runs "smtphost"
port Y 输出 The port your SMTP server listens on "9999"
user Y 输出 The user to authenticate against the SMTP server "user"
password Y 输出 用户密码 "password"
skipTLSVerify N 输出 If set to true, the SMPT server’s TLS certificate will not be verified. 默认值为 "false" "true", "false"
emailFrom N 输出 If set, this specifies the email address of the sender. See also "me@example.com"
emailTo N 输出 If set, this specifies the email address of the receiver. See also "me@example.com"
emailCc N 输出 If set, this specifies the email address to CC in. See also "me@example.com"
emailBcc N 输出 If set, this specifies email address to BCC in. See also "me@example.com"
subject N 输出 If set, this specifies the subject of the email message. See also "subject of mail"
priority N 输出 If set, this specifies the priority (X-Priority) of the email message, from 1 (lowest) to 5 (highest) (default value: 3). See also "1"

绑定支持

字段名为 ttlInSeconds

  • create

Example request

You can specify any of the following optional metadata properties with each request:

  • emailFrom
  • emailTo
  • emailCC
  • emailBCC
  • subject
  • priority

When sending an email, the metadata in the configuration and in the request is combined. The combined set of metadata must contain at least the emailFrom, emailTo and subject fields.

The emailTo, emailCC and emailBCC fields can contain multiple email addresses separated by a semicolon.

示例:

{
  "operation": "create",
  "metadata": {
    "emailTo": "dapr-smtp-binding@example.net",
    "emailCC": "cc1@example.net; cc2@example.net",
    "subject": "Email subject",
    "priority: "1"
  },
  "data": "Testing Dapr SMTP Binding"
}

The emailTo, emailCC and emailBCC fields can contain multiple email addresses separated by a semicolon.

相关链接