# Send Email node

Send an email from a workflow — a confirmation after a webhook, a daily report from a schedule, an alert when a guardrail fires. The node lives in the **Integrations** category of the palette and sends through a **mail credential** you pick on the node.

## Configuration

| Field | Description |
| --- | --- |
| **Label** | Display name on the canvas. |
| **Mailbox** | The mail credential to send through (`gmail`, `smtp`, or `agent_builder_mail`). A **Connect Gmail** button next to the dropdown lets you authorize a Gmail account without leaving the node. |
| **To** | Recipient address(es). Multiple recipients separated by commas or semicolons. Supports templates: `{event.body.email}`. |
| **Subject** | Subject line. Supports templates. |
| **Body format** | `Plain text` or `HTML`. HTML mode adds an automatic plain-text fallback part. |
| **Body** | Message body. Supports templates: `{last_output}`, `{outputs.<node-id>.parsed.<field>}`, `{state.key}`… |
| **Attach upstream generated file** | Enabled by default. When this node directly follows **Generate file**, the generated artifact is attached to the email and its signed URL is replaced in the body. |

Every text field supports the `{`-autocomplete: type `{` and pick from the variables available at that point of the graph.

### Multiple recipients

Separate addresses in **To** with commas or semicolons:

```text
modou@example.com, awa@example.com, support@example.com
```

Fixed addresses and templates can be combined:

```text
{event.body.email}; support@systalink.sn
```

The node provides three recipient fields:

- **To**: primary recipients, visible to everyone.
- **CC**: recipients receiving a visible copy.
- **BCC**: recipients receiving a hidden copy; their addresses are not shown to the other recipients.

Each field accepts one or more comma- or semicolon-separated addresses and supports templates. For a fully individual delivery, provide a recipient list to **Split In Batches** and execute Send Email once per recipient.

Example for sending a confirmation while copying the account manager and silently archiving the message:

```text
To:  {event.body.customer_email}
CC:  manager@example.com; {state.account_owner_email}
BCC: email-archive@example.com
```

In this example, the customer and account manager can see each other's addresses. The archive address receives the message but is not visible to them. CC and BCC work with Gmail OAuth, a custom SMTP credential, and the shared platform mailbox.

## Mail credential providers

| Provider | How it sends | Setup |
| --- | --- | --- |
| `gmail` | Gmail API (`users.messages.send`) with an OAuth token, auto-refreshed | Click **Connect Gmail** in the node (or on the Credentials page) and approve the popup |
| `smtp` | Direct SMTP (`smtplib`) — STARTTLS by default, implicit SSL on port 465 | Create an `Email — SMTP server` credential: host, port, username, From address, password (the secret) |
| `agent_builder_mail` | Shared platform mailbox over SMTP | Just create the credential — no secret to paste; the server is configured via `AGENT_BUILDER_SMTP_*` |

### Gmail Connect flow

1. Open the node config — the **Mailbox** dropdown shows your existing mail credentials.
2. Click **Connect Gmail**. An OAuth popup opens; sign in and approve the `gmail.send` scope.
3. The credential is created automatically and **auto-selected** on the node.

The *From* address is always the authenticated Google account. Tokens refresh automatically — no re-connect needed when the access token expires.

### SMTP notes

- Port **587** (default) uses STARTTLS; port **465** switches to implicit SSL automatically.
- The connection details (host, port, username, From) live in the credential's metadata; only the password is stored as an encrypted secret.
- The **Test** button on the Credentials page opens the connection and authenticates without sending mail.

## Templates in practice

```text
To:      {event.body.email}
Subject: Your ticket {outputs.classify-1.raw} was received
Body:
Hi {event.body.name},

{outputs.agent-reply.raw}

Reference: {state.ticket_id}
```

## Generated file attachments

When **Generate file** is wired directly into **Send Email**, the runtime resolves the generated file row for the workflow owner and adds it as a real email attachment. If the body contains `{file_url}` or the upstream file URL, that link is replaced with an attachment marker so recipients get the file instead of a temporary link.

```text
Generate file (format: csv, filename: report-{ts})
  → Send Email (body: "The report is attached. Fallback: {file_url}")
```

The email body becomes a normal message and the CSV/PDF/XLSX/etc. is attached. Turn off **Attach upstream generated file** only when you intentionally want to send the signed URL.

## What downstream nodes see

On success, `last_output` (and `{outputs.<node-id>.raw}`) is `Email sent to <recipients>`.

On failure the node does **not** stop the run — like HTTP Request, it writes the error to `last_output`, prefixed with `Send Email Error:`. Branch on it explicitly if delivery is critical:

```text
Send Email → If/else (input contains "Send Email Error") → fallback branch
```

## Gotchas

- **No credential selected** → `Send Email Error: no credential selected on this node.` Pick a Mailbox.
- **`agent_builder_mail` not configured server-side** → the run reports that the shared mailbox is not configured yet. Use `smtp` or `gmail` instead, or ask your admin to set `AGENT_BUILDER_SMTP_*`.
- **Gmail sends from the connected account** — you cannot override the From address with this provider; use `smtp` if you need a custom sender.
- **HTML emails**: set Body format to `HTML` — sending HTML markup in plain-text mode shows the tags literally.

---

*Source: https://agentbuilder.systalink.sn/docs/node-send-email — human documentation.*
*Other language: [/docs-md/fr/node-send-email.md](/docs-md/fr/node-send-email.md).*
*Machine-readable index: [/llms.txt](/llms.txt).*
