Toggle menu

Email Action

The email action field sends an email when a page on your form is submitted (ie it can be placed between pages on a multipage form or the final page of any form). It can also generate a PDF of the submission which is added as an attachment to the email.

The content of both the email and PDF can be completely customised using Handlebars templates and can take values of fields directly from your form.

You can include multiple email action fields on a form, sending different parts of the form submission to different people. This is useful if you want to send the full submission to someone at your organisation, but only a confirmation email to the person who completed the form.

This action field can be placed in any container, including the conditional layout, or at the page level.

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.

Field Properties

LabelDescriptionType Name
FromThe email address that the email should appear to have been sent from. This must be a valid email address from your domain (see Emails in our hosting documentation). Leave this blank to use the default from address set in the email workerFROM
SubjectThe email subject text. The value of another field can be used by adding the field's name between # characters, or variable using % characters, for example #FIELDNAME# or %VARIABLENAME%. This must be the complete field name when an external type definition is usedSUBJECT
ToThe main recipient(s) of the email, comma separated. The value of another field can be used by adding the field's name between # characters, or variable using % characters, for example #FIELDNAME# or %VARIABLENAME%. This must be the complete field name when an external type definition is usedTO
CcCopy to (Cc) recipients, comma separated. The value of another field can be used by adding the field's name between # characters, or variable using % characters, for example #FIELDNAME# or %VARIABLENAME%. This must be the complete field name when an external type definition is usedCC
BccBlind copy to (Bcc) recipients, comma separated. The value of another field may be used by adding the field's name between # characters, or variable using % characters, for example #FIELDNAME# or %VARIABLENAME%. This must be the complete field name when an external type definition is usedBCC
BodyThe main content of the email. The values of other fields can be accessed by adding their names to the body between # characters, or variable using % characters, for example #FIELDNAME# or %VARIABLENAME%. This must be the complete field name when an external type definition is used

Handlebars templating can also be used, see Handlebars Editors

{{{RENDEREDFORM}}}will generate a rendered copy of the form data. This is the default behaviour if the body is left empty. 

{{DATA.aCustomValue}}will insert the value of the "aCustomValue" property of the data returned by the Data function (see below)
BODY
Email Message FormatControls whether the email message should be sent as HTML or plain text. Typically this should be set to HTML. Where plain text is needed it should be combined with a custom Handlebars template to avoid the HTML markup that will be generated by the default, rendered form behaviour.

Note that if plain text is used headers/footers from the email worker configuration are not added
BODYFORMAT
Include uploaded files?No - Uploaded files will not be attached to the email
Yes - Files added this session - Files uploaded while filling out this form will be attached to the email
Yes - All files - All files present in the form data are attached. See below for an explanation

Note that 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 for the complete email, including embedded images and attachments
INCLUDEUPLOADS
Generate PDFIf true a PDF will be generated using the template in the PDF Body setting below. If no template is supplied the PDF will contain all of the form data. The generated PDF will be attached to the email and sent to all recipientsGENERATEPDF
PDF NameThe name of the PDF file attachment. It should end with .pdf to be processed correctly. The value of another field can be used by adding the field's name between # characters, or variable using % characters, for example #FIELDNAME# or %VARIABLENAME%PDFNAME
PDF BodyThe main content of the PDF. Values of other fields and a Handlebars template can be used in the same was as the Email BodyPDFBODY
Data functionA function that add additional data to the email.

This function is executed server-side when the action is executed and the resulting data is then passed through to the email in an object called DATA.

For example, you could call an End Point using:

function(helper, data) {
    var request = {
        property1: 'myRequest'
    };
    data = helper.utilServerAPIServerCall('serverlibrary', 'test.testone', request);
    return data;
}

Email Data Function
 
In the Email and PDF Body Handlebars templates, this additional data can be accessed using the DATA prefix. For example, using the above function, {{DATA}}would output the full response from the End Point.
EMAILDATAFUNC
DocumentationAdd documentation to your field to help explain any complex functionality to future users. You might include information on what the field does and how it relates to other fields on the form. Notes added here are only ever visible in the Forms Designer, they can be searched for, viewed and downloaded from the action panel. See Common Field Properties for an exampleDOCUMENTATION

Action Results

The following can be accessed using .utilGetActionResults once the action has been processed. The action will return an error if at least one email failed to send.

"FIELDNAME": {
    "numFailed": "0",
    "errorMessages": "",
    "numSent": "1",
    "success": "true"
}

File Uploads

It's important to understand the two "Yes" options, especially if you are building workflow user tasks.

Imagine a form that includes a file upload field (UPLOAD1) and starts a workflow process. A subsequent user task in the workflow displays that uploaded file to the next user (eg by including an upload field called UPLOAD1), has a second upload field (UPLOAD2), and has an email action. Setting the email action as "Files added this session" would only attach UPLOAD2. Setting the email action as "All files" would attach UPLOAD1 and UPLOAD2 because both are present in the form data.

If you don't attach files to the email you will need to store them in the platform to be picked up later. You could start a workflow process, write the data to history, or use the database save action. See Handling File Uploads in the knowledge base for further information.

Example

Enter your email address to receive an email. The email uses #NAME# to customise the email body and #EMAIL# as the "To" address. (The fields on the form are named NAME and EMAIL). The PDF attached to the email is a full copy of the form submission.

Share this page

Facebook icon Twitter icon email icon

Print

print icon