SMTP binding spec

Detailed documentation on the SMTP binding component

配置

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

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: smtp
  5. namespace: default
  6. spec:
  7. type: bindings.smtp
  8. version: v1
  9. metadata:
  10. - name: host
  11. value: "smtp host"
  12. - name: port
  13. value: "smtp port"
  14. - name: user
  15. value: "username"
  16. - name: password
  17. value: "password"
  18. - name: skipTLSVerify
  19. value: true|false
  20. - name: emailFrom
  21. value: "sender@example.com"
  22. - name: emailTo
  23. value: "receiver@example.com"
  24. - name: emailCC
  25. value: "cc@example.com"
  26. - name: emailBCC
  27. value: "bcc@example.com"
  28. - name: subject
  29. value: "subject"

Warning

The example configuration shown above, contain a username and password as plain-text strings. 更推荐的方式是使用 Secret 组件, 这里

元数据字段规范

字段必填绑定支持详情示例
hostYOutputThe host where your SMTP server runs“smtphost”
portYOutputThe port your SMTP server listens on“9999”
userYOutputThe user to authenticate against the SMTP server“user”
passwordYOutput用户密码“password”
skipTLSVerifyNOutputIf set to true, the SMPT server’s TLS certificate will not be verified. 默认值为 “false”“true”, “false”
emailFromNOutputIf set, this specifies the email address of the sender. See also“me@example.com”
emailToNOutputIf set, this specifies the email address of the receiver. See also“me@example.com”
emailCcNOutputIf set, this specifies the email address to CC in. See also“me@example.com”
emailBccNOutputIf set, this specifies email address to BCC in. See also“me@example.com”
subjectNOutputIf set, this specifies the subject of the email message. See also“subject of mail”

绑定支持

该组件支持输出绑定,其操作如下:

  • create

Example request

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

  • emailFrom
  • emailTo
  • emailCC
  • emailBCC
  • subject

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.

示例:

  1. {
  2. "operation": "create",
  3. "metadata": {
  4. "emailTo": "dapr-smtp-binding@example.net",
  5. "emailCC": "cc1@example.net; cc2@example.net",
  6. "subject": "Email subject"
  7. },
  8. "data": "Testing Dapr SMTP Binding"
  9. }

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

相关链接