chesterdocs

#Send an email with a send task

A send task sends one email through an email adapter, with recipients, subject and body filled from the process data and files from earlier steps attached.

#What happens when the process reaches it

flowchart LR
  A["Send task starts"] --> B["Fill in recipients,<br/>subject and body"]
  B --> C["Send through the<br/>email adapter's server"]
  C -- "accepted" --> N["Next step"]
  C -- "server busy,<br/>network error" --> R["Retry after<br/>1 s, 2 s, 4 s"] --> C
  C -- "login refused, bad address,<br/>message rejected" --> F["The task fails<br/>at once"]

#Configure a send task

  1. Connection settings → Email adapter: click + and pick the system and its email adapter. Only email adapters are offered, and there is no action to pick.
  2. Recipients & subject:
    • To — required. A list of addresses, such as ["alice@example.com", "bob@example.com"], or a variable holding one. A text with commas between the addresses works too.
    • Subject — required.
    • Add optional adds CC, BCC, From (override) and Reply-To.
  3. Email content: write the email like a normal one. + inserts a value from the process at the cursor; ƒ inserts a calculation — a small piece of code whose result appears in the text, for example a list or a formatted number.
  4. Attachments (collapsed): Add attachment and pick a variable that holds a file, or a list of files, from an earlier step. A web address (https://…) is downloaded and attached as well.

Every field accepts fixed text, a variable or an expression.

To send one email per item of a list — per customer, per order — switch on Multi-instance and use __loop.item in the fields. See Run a step once per item.

#Where the mail server is set

The mail server, its login, the default sender and the default Reply-To belong to the email adapter, under Systems. A send task has no Environment and no Credentials field: the same server is used for development and production deployments. See Systems and adapters.

If From (override) is empty, the adapter's sender address and name are used, and its Reply-To.

#When sending fails

What went wrong What happens
The server is busy (a temporary refusal), cannot be reached in time, or the network drops Retried up to three times, after 1 s, 2 s and 4 s
The login is refused, an address is invalid, the message is rejected, the configuration is incomplete or the secure connection fails The task fails at once

When the task fails, an error boundary event on it takes over if there is one; otherwise the instance fails. The reason, with its code such as EMAIL_AUTH_FAILED, is in the instance's history.

A value whose expression cannot be worked out fails the task, too. An empty To or Subject at run time fails it without a retry.

#What the task hands on

Nothing. A send task adds no data to the process — not even the message id — so later steps cannot check that the email went out.

#What a send task cannot do

  • ⚠️ Guarantee the attachments. An attachment that is not a file, cannot be loaded or cannot be downloaded is left out with only a warning in the log, and the email is sent without it.
  • ⚠️ Report a partly rejected recipient list. If the server accepts some addresses and refuses others, the task still counts as done.
  • ⚠️ Keep the default Reply-To with a sender override. When From (override) is set, the adapter's default Reply-To is dropped, and the sender appears without a display name. Set Reply-To on the task as well if you need one.
  • ⚠️ Fail on a broken calculation. A calculation in the body that fails is left empty, and the email is sent.
  • ⚠️ Show calculations in the plain-text part. Every email is also sent as plain text, and there the calculations are missing.
  • ⚠️ The Email adapter field still says "Click + to select an action" while it is empty.
  • ❌ Templates. The body is written on the task itself.
  • ❌ Other channels than email.
  • ❌ Rename an attachment. The file is sent under its own name.

#What validation checks

An email adapter must be selected — a send task accepts no other kind of adapter — and To, Subject and the email content must be filled in. The messages are shown in German. See Check that a process can run.