---
title: "Action send_email"
description: "Sends an HTML email via SMTP with attachments and constant collection."
---

# Action `send_email`

> **System ID:** `action_send_email`

## Description

Sends an email (HTML) via SMTP. Supports placeholders, attachments, and collecting constant values into the email body. SMTP can be set in the node config or taken from instance settings.

Special syntax in `html`:

- `{{constants:name1|name2}}` — substitutes the listed constants
- `{{startsWith:prefix}}` — all constants with that prefix

## Events (scenario branches)

| Event | When it occurs |
|-------|----------------|
| **success** | Email sent |
| *(no branch)* | Required fields missing or SMTP not configured |

## Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `subject` | string | yes | — | Email subject (placeholders) |
| `to` | string | yes | — | Recipient email (placeholders) |
| `html` | string | yes | — | HTML body (placeholders, special syntax) |
| `from` | string | no | — | Sender; if missing — login is used |
| `service` | string | no | — | SMTP service (`mailgun`, `mailjet`, `empty`, etc.) |
| `host` | string | no | — | SMTP host |
| `port` | number | no | `587` | SMTP port |
| `secure` | number | no | `1` | Secure connection (`1` / `0`) |
| `login` | string | no | — | SMTP login |
| `password` | string | no | — | SMTP password |
| `attachments` | array | no | `[]` | Attachments: `filename`/`path`/`content` or `constant` |

## Configuration example

```json
{
  "subject": "Нова реєстрація",
  "to": "admin@example.com",
  "html": "Дані:<br><br>{{startsWith:reg_}}",
  "from": "noreply@example.com",
  "attachments": [
    {
      "filename": "document.pdf",
      "path": "https://example.com/files/document.pdf"
    }
  ]
}
```

## Related docs

- [Actions reference](/en/actionjail/reference/actions-reference.md)
