Toggle menu

Workflow Activities

Workflow Mail Task

Mail task

The mail task is used to send email. When a process execution arrives at the mail task, the task is automatically executed. This task uses the API Server's Email Worker, which means you can generate PDFs, handle attachments and use Handlebars templating. Note that this task is not an official task of the BPMN 2.0 specification.

PropertyDescription
IDAn optional unique ID for this element. The modeller will assign a random ID if left blank
NameA name for this element
DescriptionAn optional description for this element
AsynchronousWhen execution reaches a task that has been marked as asynchronous the engine will commit the current transaction and schedule a background job to continue the process from the asynchronous task
ToA comma separated list of recipients. Can include values from stored process variables using ${form_EMAIL} (where EMAIL is the name of a field on the form that interacted with this process instance containing the user's email address)

You must be confident that the variables you reference exist. If they don't, the mail task will error and no emails will be sent. This could be checked with a preceding script task, for example:

if (execution.hasVariable("form_EMAIL") == false){
    execution.setVariable("form_EMAIL", "");
}
FromThe from address. Leave this blank to use the from address set in the email worker
SubjectThe subject line of the email
Use Handlebars for Subject?Check this box to enable Handlebars templating in the subject line
CcA comma separated list of recipients, works in the same way as the "To" field
BccA comma separated list of recipients, works in the same way as the "To" field
TextA text only fall-back version of the email for email clients that don't support rich content
HTMLThe HTML content of the email, see below
Use HandlebarsTrue if checked. Handlebars templating can be used to process the body of the email
PDF TemplateA Handlebars template used to generate a PDF attachment, see below
PDF FilenameThe name given to the generated PDF
AttachmentsA array of process variable names that represent attachments. See below
Return VariableThe process variable that any return from the activity will be stored in
Transient Return Variable?If enabled, the result will be stored as a transient process variable instead of a persistent one. Transient variables are not saved to the database or process history, and are only visible until the process reaches its next wait state
Error VariableThe process variable that any error will be stored in
Error HandlingShould an error occur will it be ignored, follow the transition specified on the advanced tab (ie the ID of a sequence flow from the current activity), or throw a BPMN error which could be caught by a boundary error event

HTML Body Content

Mail Task HTML Content

The email generated by the mail task can include HTML content, Handlebars templating and simple value substitution.

A header and footer can be added to the email if the email header and footer process variables have been set via the Workflow Worker's configuration. See Process Variables for further information.

PDF Template

The PDF template can be used to generate a PDF version of the email (or any other content) which is automatically attached to the email generated by the mail task (in addition to any other attachments). The name of the PDF attachment is set in the PDF Filename property.

See the Email Worker documentation for further information, including how to configure PDF headers, footers and styling.

Attachments

The attachments property allows you to attach files to the generated email. It is an array of strings, with each string identifying a file. Files can be referenced in two ways: the file UUID, or the value of an upload form field.

A single explicit file identifier would be added to the attachments property as: ["0a148876-c9c3-4e8f-9d3d-cfb476446540"]

The values of upload form fields are added as: ["${form_UPLOADFIELD1}","${form_UPLOADFIELD2}"]

You can create the array in a preceding script task, setting it as the value of a variable using execution.setVariable(). This variable could then be used in the attachment property as: ${myVariable}

See the Handling File Uploads knowledge base article for more information about how the platform handles file uploads and File Uploads and Email Attachments in Workflow for a more detailed look at attachments.

Limits

All mail servers put limits on the total size of the emails they will accept. In AWS (our main hosting provider) the size limit is 40MB after encoding for the complete email, including embedded images and attachments.

There is also a limit of 50 recipients for a single message (combined "to", "cc" and "bcc"). When sending emails you should be emailing each recipient individually. The use cases for recipients having a message with the same message-id are limited to situations in which the recipients are expected to interact with the message as a group, for example, recipients using reply-all to the email and having a resulting email conversation.

Last modified on 30 September 2026