---
title: "send email · RUAL Documentation"
description: "Builds an RFC 5322 message and hands it to the SMTP server on the connection. Use this to deliver through your own MTA (Exim, Postfix) rather than a hos…"
canonical: https://docs.rual.nl/block-types/smtp/smtpconnection_send_email
language: en
---

[Cluster](https://docs.rual.nl/cluster)

[Blocks](https://docs.rual.nl/block-types)

[Interfaces](https://docs.rual.nl/interfaces)

[Blueprints](https://docs.rual.nl/blueprints)

[Blueprint Language](https://docs.rual.nl/engine)

[Tutorials](https://docs.rual.nl/tutorials)

[Home automation](https://docs.rual.nl/home-automation)

[Examples](https://docs.rual.nl/examples)

[Reference](https://docs.rual.nl/reference)

[Architecture](https://docs.rual.nl/architecture)

[Troubleshooting](https://docs.rual.nl/troubleshooting)

Other

# send email

This block is part of the [`smtp`](https://docs.rual.nl/block-types/smtp) group and was last modified in core [`v15.0.1`](https://docs.rual.nl/core-versions/150001).

Builds an RFC 5322 message and hands it to the SMTP server on the connection. Use this to deliver through your own MTA (Exim, Postfix) rather than a hosted API.

- flow `flow`

- connection required `smtpconnection`

- from required `value` Envelope and header sender. Either a bare address or `"Name" `.

- to required `array` Recipient addresses.

- cc `array` Copy recipients. In the headers and in the envelope.

- bcc `array` Blind copy recipients. In the envelope only : never written to the headers.

- reply to `value` Reply-To header.

- subject required `value` Subject header. RFC 2047 encoded when it is not plain ASCII.

- html `value` HTML body.

- text version `value` Plain-text body. Derived from the HTML by stripping tags when left empty.

- headers `object` Extra headers, e.g. `In-Reply-To`, `References`, `List-Unsubscribe`, `X-Mailer`. `From`, `To`, `Bcc` and `Message-ID` are refused : the last because the `message_id` pin is what the `message_id` out-pin reports.

- message id `value` Message-ID to use. Minted as ` ` when empty. Refused when it holds whitespace, control characters or angle brackets other than a surrounding pair.

- attachments `array` `{ name, content_type, content_base64 }` or `{ name, content_type, path }` : a path is read from the entity's own file storage.

- attachment `file` File pin attachments, the same shape the postmark and lettermint blocks take.

- inline images `array` `{ cid, content_type, content_base64 }` : referenced from the HTML as `cid: `.

- flow `flow`

- connection `smtpconnection`

- success `condition`

- error `value`

- message id `value`

- response `object`

Composes a complete MIME message and submits it over SMTP. Body structure is chosen from what is filled: text+html become multipart/alternative, inline_images wrap that in multipart/related, attachments wrap the result in multipart/mixed, and a single body alone is sent as one part. text is derived from html by stripping tags when the text pin is empty. Non-ASCII header values are RFC 2047 encoded; bodies are quoted-printable or base64 so the wire stays 7-bit safe; lines end CRLF. The ENVELOPE is from + to + cc + bcc; Bcc never appears in the headers, and the headers pin refuses From/To/Bcc/Message-ID overrides (Message-ID comes from the message_id pin only, so the message_id out-pin always reports the delivered id). Every header value is sanitized against line breaks; message_id, an inline image cid and an address net/mail could not parse are refused outright when they hold whitespace, control characters or angle brackets. message_id is minted as <uuid@domain-of-from> when the pin is empty and is always reported on the message_id out-pin. Suppressed in simulation: a dry-run never sends.

| `smtp` |
| --- |
| `mta` |
| `relay` |
| `send mail` |

A typical wiring for [send email](https://docs.rual.nl/block-types/smtp/smtpconnection_send_email): a [function trigger](https://docs.rual.nl/block-types/globals/trigger_custom_function) starts the flow; [open connection](https://docs.rual.nl/block-types/smtp/smtpconnection_open) feeds the `connection` pin; [value](https://docs.rual.nl/block-types/value/value_default) feeds the `from` pin; [with values](https://docs.rual.nl/block-types/array/array_of_values) feeds the `array_to` pin; [value](https://docs.rual.nl/block-types/value/value_default) feeds the `subject` pin; the `flow` out pin feeds [debug](https://docs.rual.nl/block-types/state%2520ui/state_debug).

[![Studio canvas example for the send email block: typical wiring for send email.](https://docs.rual.nl/canvas-examples/smtpconnection_send_email.png)](https://docs.rual.nl/canvas-examples/smtpconnection_send_email.png?v=3)

## Version history

Introduced in [`v15.0.1`](https://docs.rual.nl/core-versions/150001).

- [Back to `smtp`](https://docs.rual.nl/block-types/smtp): Return to the main group to view all sub-groups

- [Back to `smtp`](https://docs.rual.nl/block-types/smtp?group=smtp): Return to the group to view all blocks within this group

Was this page helpful? [Tell us what to improve](https://docs.rual.nl/support) · RUAL Docs is an integral component of the [RUAL ecosystem](https://rual.nl)
