IronFlowDocs

send_email

Send an email via the Resend API or SMTP.

Parameters

Common Parameters

providerstringdefault "resend"
Email provider: "resend" or "smtp".
tostring or arrayrequired
Recipient email address(es). Supports ${ctx.key} interpolation.
subjectstringrequired
Email subject line. Supports interpolation.
fromstringdefault env SENDER_EMAIL or "[email protected]"
Sender email address.
htmlstring
HTML body content. Supports interpolation.
textstring
Plain text body content. Supports interpolation.
ccstring or array
CC recipient(s).
bccstring or array
BCC recipient(s).
reply_tostring or array
Reply-To address(es).
timeoutnumberdefault 30
Request timeout in seconds.
output_keystringdefault "email"
Prefix for context output keys.

Resend-specific Parameters

ParameterTypeRequiredDefaultDescription
api_keystringnoenv RESEND_API_KEYResend API key.
api_urlstringno"https://api.resend.com/emails"Explicit Resend-compatible endpoint, including a local test fixture.

SMTP-specific Parameters

ParameterTypeRequiredDefaultDescription
smtp_serverstringnoenv SMTP_SERVERSMTP server hostname.
smtp_portnumbernoenv SMTP_PORT or provider defaultSMTP port (587 for STARTTLS, 465 for TLS, 25 for none).
smtp_usernamestringnoenv SMTP_USERNAMESMTP authentication username.
smtp_passwordstringnoenv SMTP_PASSWORDSMTP authentication password.
smtp_tlsstringno"starttls"TLS mode: "starttls" (default), "tls" (implicit), or "none".

HTTP Transport

Resend API requests follow redirects only within the original scheme, host, and effective port, with at most 10 hops. Cross-origin redirects fail before replaying email content; automatic Referer is disabled. Configure the final API endpoint explicitly when its origin changes. This policy does not change the SMTP provider.

Resend success and error response bodies share IRONFLOW_MAX_HTTP_BODY_BYTES (default 52428800, 50 MiB). An oversized Content-Length fails before body collection; actual bytes are checked before each chunk is retained, including chunked responses. Exceeding the cap, an interrupted body, timeout, or run cancellation fails or cancels the step without publishing partial email output. The limit counts received body bytes before charset/BOM decoding. It is not a total-memory or decoded-JSON limit. The SMTP provider is unaffected.

Within-limit non-2xx responses still fail with their status and redacted body detail. Oversized responses fail with the size error before provider body parsing. A failed response read does not prove the email was not delivered; retrying can send the email again.

Context Output

  • {output_key}_status — HTTP status code (Resend) or SMTP response code.
  • {output_key}_data — Response body (Resend JSON if parseable, otherwise decoded text) or SMTP response details.
  • {output_key}_success — true on success.

Environment Variables

VariableDescription
RESEND_API_KEYResend API key (fallback when api_key is not in config)
SENDER_EMAILDefault sender address (fallback when from is not in config)
SMTP_SERVERSMTP server hostname
SMTP_PORTSMTP server port
SMTP_USERNAMESMTP authentication username
SMTP_PASSWORDSMTP authentication password

Examples

Resend API

The runnable Resend example reads the optional RESEND_API_URL environment variable into api_url for a local HTTP fixture; omitting it retains the normal API endpoint. This variable is an example convention, not a node-level fallback. Keep API credentials synthetic when testing against an alternate endpoint.

local flow = Flow.new("send_email_resend")

flow:step("send", nodes.send_email({
    to = env("SENDER_EMAIL"),
    subject = "Welcome to IronFlow!",
    html = "<h1>Welcome!</h1><p>Your workflow engine is ready.</p>",
    text = "Welcome! Your workflow engine is ready."
}))

flow:step("log", nodes.log({
    message = "Email result: success=${ctx.email_success}, data=${ctx.email_data}"
})):depends_on("send")

return flow

SMTP

local flow = Flow.new("send_email_smtp")

flow:step("send", nodes.send_email({
    provider = "smtp",
    to = env("SENDER_EMAIL"),
    subject = "IronFlow SMTP Test",
    html = "<h1>Hello!</h1><p>Sent via SMTP.</p>",
    text = "Hello! Sent via SMTP."
}))

return flow

Multiple recipients

flow:step("notify_team", nodes.send_email({
    to = { "[email protected]", "[email protected]" },
    from = "[email protected]",
    subject = "Deploy complete: ${ctx.version}",
    html = "<p>Version <b>${ctx.version}</b> deployed.</p>",
    cc = "[email protected]",
    output_key = "deploy_email"
}))

IronFlow documentation

Find the next step

Type a keyword to search the documentation.

↑ ↓ to move · Enter to open · Esc to close