sendEmail

Flow pipeline processor that facilitates sending emails.

The email details are parsed from the message exchange payload, which has a strictly defined schema.

The email content can either be a plain text or an HTML. The processor does not do any content type validation, so it is the caller’s responsibility to ensure that the content is in the expected format.

Attachments

The processor supports both regular and inline attachments. Inline attachments can be embedded within the HTML body by referencing their contentId. All attachments are validated before sending — invalid attachment data or missing required fields will prevent the email from being sent.

Attachment handling is subject to configurable size limits:

  • Total message size limit: The maximum size of the entire email (including headers, body, and all attachments), measured as encoded (wire) bytes. This is the authoritative limit enforced by SMTP servers.

  • Per-attachment size limit: The maximum size of an individual attachment, measured as decoded (raw) bytes. This provides early rejection of oversized files.

  • Attachment count limit: The maximum total number of attachments (regular and inline combined).

Each limit is enforced independently. The flow server configuration specifies the values for these limits. Emails that exceed any of these limits will not be sent.

Message payload structure

The following table describes the element structure of the message payload:

field name            | type                          | required                           | description
----------------------|-------------------------------|------------------------------------|---------------------------------------------------------------------------
from                  | String                        | no                                 | Sender address
to                    | List<String>                  | yes (non-empty)                    | List of email recipients
cc                    | List<String>                  | no                                 | List of CC recipients
bcc                   | List<String>                  | no                                 | List of BCC recipients
replyTo               | String                        | no                                 | An address that will be set in the Reply-To header
subject               | String                        | no                                 | Email subject
plainTextBody         | String                        | yes (or htmlBody - non blank)      | Email message body in plain text format. Mutually exclusive with `htmlBody`
htmlBody              | String                        | yes (or plainTextBody - non blank) | Email message body in HTML format. Mutually exclusive with `plainTextBody`
attachments           | List<Attachment>              | no                                 | List of regular (non-inline) attachments
inlinedAttachments    | List<InlinedAttachment>       | no                                 | List of inline attachments that can be referenced in the HTML body

Attachment Structure

Regular Attachment:

field name     | type   | required | description
---------------|--------|----------|------------------------------------------------------------
contentType    | String | yes      | MIME type of the attachment (e.g., "application/pdf")
filename       | String | yes      | Name of the file
base64Content  | String | yes      | Base64-encoded content of the attachment

Inline Attachment:

field name     | type   | required | description
---------------|--------|----------|------------------------------------------------------------
contentType    | String | yes      | MIME type of the attachment (e.g., "image/png")
filename       | String | yes      | Name of the file
contentId      | String | yes      | Unique identifier to reference this attachment in the HTML body
base64Content  | String | yes      | Base64-encoded content of the attachment

Example Payloads

Simple email without attachments:

{
  "from": "sender@example.com",
  "to": ["recipient@example.com"],
  "cc": ["recipient_cc@example.com"],
  "bcc": ["recipient_bcc1@example.com", "recipient_bcc2@example.com"],
  "replyTo": "replyto@example.com",
  "subject": "Hello",
  "htmlBody": "<h1>HTML content</h1>"
}

Email with regular and inline attachments:

{
  "from": "sender@example.com",
  "to": ["recipient@example.com"],
  "subject": "Your report",
  "htmlBody": "<h3>See attached. <img src='cid:logo1' /></h3>",
  "attachments": [
    {
      "contentType": "application/pdf",
      "filename": "report.pdf",
      "base64Content": "JVBERi0xLjQK..."
    }
  ],
  "inlinedAttachments": [
    {
      "contentType": "image/png",
      "filename": "logo.png",
      "contentId": "logo1",
      "base64Content": "iVBORw0KGgo..."
    }
  ]
}

Plain text email:

{
  "from": "sender@example.com",
  "to": ["recipient@example.com"],
  "subject": "Hello",
  "plainTextBody": "Plain text content"
}
The processor requires the flow server to be configured with SMTP server details. Attachment size limits have default values but can be adjusted via server configuration.

Properties

Name Summary

connectionTimeoutMillis

The time to wait while connecting to a remote server.

receiveTimeoutMillis

Maximum allowed inactivity while waiting for the next bytes from the socket. Optional.

retainPayloadOnFailure

Whether the incoming payload is available for error processing on failure. Defaults to false.

name

Optional, descriptive name for the processor.

id

Required identifier of the processor, unique across all processors within the flow. Must be between 3 and 30 characters long; contain only lower and uppercase alphabetical characters (a-z and A-Z), numbers, dashes ("-"), and underscores ("_"); and start with an alphabetical character. In other words, it adheres to the regex pattern [a-zA-Z][a-zA-Z0-9_-]{2,29}.

exchangeProperties

Optional set of custom properties in a simple jdk-format, that are added to the message exchange properties before processing the incoming payload. Any existing properties with the same name will be replaced by properties defined here.

Sub-builders

Name Summary

externalSystemDetails

Information describing external system integration. Optional.

inboundTransformationStrategy

Strategy that customizes the conversion of an incoming payload by a processor (e.g., string to object). Should be used when the processor’s default conversion logic cannot be used.

messageLoggingStrategy

Strategy for describing how a processor’s message is logged on the server.

payloadArchivingStrategy

Strategy for archiving payloads.