SMTP binding spec

Detailed documentation on the SMTP binding component

Component format

To setup SMTP binding create a component of type bindings.smtp. See this guide on how to create and apply a binding configuration.

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

Warning

The example configuration shown above, contain a username and password as plain-text strings. It is recommended to use a secret store for the secrets as described here.

Spec metadata fields

FieldRequiredBinding supportDetailsExample
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”
passwordYOutputThe password of the user“password”
skipTLSVerifyNOutputIf set to true, the SMPT server’s TLS certificate will not be verified. Defaults to “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”
priorityNOutputIf set, this specifies the priority (X-Priority) of the email message, from 1 (lowest) to 5 (highest) (default value: 3). See also“1”

Binding support

This component supports output binding with the following operations:

  • 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.

Example:

  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. "priority: "1"
  8. },
  9. "data": "Testing Dapr SMTP Binding"
  10. }

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

Last modified July 27, 2022: Remove namespace element from component examples (#2647) (ff9de5c8)