send email
This block is part of the smtp group and was last modified in core v15.0.1.
send email v15.0.1 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
valueEnvelope and header sender. Either a bare address or
"Name" <email@example.com>. - to required
arrayRecipient addresses.
- cc
arrayCopy recipients. In the headers and in the envelope.
- bcc
arrayBlind copy recipients. In the envelope only : never written to the headers.
- reply to
valueReply-To header.
- subject required
valueSubject header. RFC 2047 encoded when it is not plain ASCII.
- html
valueHTML body.
- text version
valuePlain-text body. Derived from the HTML by stripping tags when left empty.
- headers
objectExtra headers, e.g.
In-Reply-To,References,List-Unsubscribe,X-Mailer.From,To,BccandMessage-IDare refused : the last because themessage_idpin is what themessage_idout-pin reports. - message id
valueMessage-ID to use. Minted as
<uuid@domain-of-from>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
fileFile pin attachments, the same shape the postmark and lettermint blocks take.
- inline images
array{ cid, content_type, content_base64 }: referenced from the HTML ascid:<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: a function trigger starts the flow; open connection feeds the connection pin; value feeds the from pin; with values feeds the array_to pin; value feeds the subject pin; the flow out pin feeds debug.
Version history
Introduced in v15.0.1.
Back to
smtp Return to the main group to view all sub-groups Back to smtp Return to the group to view all blocks within this group 