Email connector

The email connector is used to send emails using the SMTP protocol as part of a process instance.

The email connector is displayed on the process diagram as an envelope.

Important: The email connector requires an email server to use. This server is separate to the Alfresco hosted environment and should be created and managed by customers.

Send

The SEND action is used by the email connector to send an email and optional attachments.

The input parameters to send an email are:

ParameterTypeDescription
toStringRequired. The email addresses to send to, for example [email protected]. Multiple addresses are separated by a comma.
fromStringRequired. The email address of the sender, for example [email protected].
ccStringOptional. A carbon copy list of email addresses. Multiple addresses are separated by a comma.
bccStringOptional. A blind carbon copy list of email addresses. Multiple addresses are separated by a comma.
subjectStringOptional. The subject line of the email, for example Order No: 1234.
attachmentsFileOptional. A variable of type file containing attachments to send with the email.
charsetStringOptional Set the character set of the email, for example UTF-8.
htmlStringOptional. The body of the email in HTML, for example <p><b>Hello!</b></p>.
textStringOptional. The body of the email in plain non-rich text. Can be sent in addition to html and will be used as a fall-back if HTML is not supported by the email client reading the email.
templateFileOptional. The body of the email generated from a FreeMarker template stored as a file variable.
metadataJSONOptional. Metadata to be used by the template when generating the file to include process variables in the output.

Template

A FreeMarker template can be used to generate the body of the email. Optional metadata can also be used with the template to insert values from process variables into the document template.

An example of the metadata that can be used by the template is:

{
"iceCream": {
    "flavor":"Mint"
    },
"timeOfYear": {
    "season":"Summer"
    }
}

An example of how the template can import values from the metadata is:

<html>
<head>
  <title>Welcome!</title>
</head>
<body>
  <h1>Welcome to ${timeOfYear.season}!</h1>
  <p>Our latest product is ${iceCream.flavor} ice cream!</p>
</body>
</html>

Configuration parameters

The configuration parameters for the email connector are:

ParameterDescription
EMAIL_HOSTRequired. The host address of the email server.
EMAIL_PORTRequired. The port the email server is running on.
EMAIL_USERNAMERequired. The username the connector will use to contact the email server.
EMAIL_PASSWORDRequired. The password of the user the connector will use to contact the email server.
EMAIL_SMTP_AUTHRequired. Sets whether the connection to the email server requires authentication, for example true.
EMAIL_SMTP_STARTTLSRequired. Sets whether the connection uses TLS, for example true.
POLLING_PROTOCOLOptional. The protocol to use for inbound emails, for example imaps.
POLLING_HOSTOptional. The host to be used for inbound emails.
POLLING_PORTOptional. The port to use for inbound emails.
POLLING_USERNAMEOptional. The username of the account used for inbound emails.
POLLING_PASSWORDOptional. The password of the user account used for inbound emails.
POLLING_FOLDEROptional. The folder to retrieve inbound emails from, for example INBOX.
POLLING_PAGINATIONOptional. The number of emails retrieved in a single request, for example 10.
CRON_SCHEDULEOptional. A Cron expression to configure the inbound polling frequency.

Note: The polling configuration parameters are used when configuring email connector triggers.

Errors

The possible errors that can be handled by the email connector are:

ErrorDescription
MISSING_INPUTA mandatory input variable was not provided.
INVALID_INPUTThe input variable has an invalid type.
TEMPLATE_READ_ERRORCannot read the FreeMarker template.
TEMPLATE_METADATA_ERRORThe template references non-existing metadata.
TEMPLATE_SYNTAX_ERRORInvalid FreeMarker syntax.
EMAIL_CONNECTION_ERRORUnable to connect to email service.
EMAIL_AUTHENTICATION_ERRORUnable to authenticate into email service.
EMAIL_SEND_ERRORUnable to send the email.
UNKNOWN_ERRORUnexpected runtime error.
BAD_REQUESTThe server could not understand the request due to invalid syntax.
UNAUTHORIZEDThe request has not been applied because it lacks valid authentication.
FORBIDDENThe server understood the request but refuses to authorize it.
NOT_FOUNDThe server could not find what was requested.
INTERNAL_SERVER_ERRORThe server has encountered a situation it doesn't know how to handle.
BAD_GATEWAYThe server got an invalid response.
SERVICE_UNAVAILABLEThe server is not ready to handle the request.
GATEWAY_TIMEOUTThe server is acting as a gateway and cannot get a response in time.

© 2023 Alfresco Software, Inc. All Rights Reserved.