Skip to main content

HTML Emails

priint:suite projects often include long-running background tasks. Rendering a publication with hundreds of documents takes time. A common requirement is to send an email automatically when a process finishes. This skeleton uses JavaMail to send HTML emails.

Create an HTML template, fill in variables from your process or publication, and add your own stylesheets.

The skeleton can run as a standalone process, but the recommended use is to integrate it into an existing process as a subprocess or call activity.

html_email.png

Sample output

Configuration​

Nameskeleton-htmlemail
Packagecom.priint.skeleton.htmlemail
Deployment packageAvailable on the priint webftp storage, in the priint_suite_accpacks folder under AccPackHtmlEmails. Please contact our support for access.

To deploy the package, see Using Accelerating Package in your Project. The deployment package installs the plugin. The Camunda process and the ISON configuration must be set up separately, as described below.

Process Definition​

SKELETON_SEND_HTML_EMAIL.bpmn

User uploaded image

Send Email Plugin​

In ISON, add the configuration XML file. It provides:

  • The HTML template
  • The email settings (sender, recipient, subject, etc.)

User uploaded image

The XML file is located in ISON at: com.priint.skeleton.htmlemail.plugin.SendEmailPlugin/Default/default/EmailTemplateConfig.xml

The RootElement should be <emailTemplate> to identify the template and the config inside.

Static Parameters​

The root element contains two important child elements: <templateConfiguration> and <config>.

  • <templateConfiguration>: has two attributes, id and name
    • id: key to select the HTML content
    • name: display name (if used as main process)
    • <subject>: subject of the email
    • <content>: HTML content of the email body
  • <config>: supports <keyValue> tags with id and value attributes

Key variables

  • configId: selects which <templateConfiguration> to use
  • sendFrom: sender address. If blank, uses the sender configured in Payara.

Payara server mail setting

  • sendTo: recipient address. Defaults to the user who starts the process. Supports multiple recipients **separated by "," ** — additional addresses are BCC.

XML Template Format​

User uploaded image

EmailTemplateConfig.xml should be like this.

All notice need in the config file

Multiple Configs​

Each <config> is matched to a <templateConfiguration> by its id attribute. Example:

<configs>
<config id='projecta'>
<keyValue key="sendTo" value="no-reply@priint.com"/>
<keyValue key="sendFrom" value="receiver@priint.com"/>
</config>
<config id='projectb'>
<keyValue key="sendTo" value="no-reply@priint.com"/>
<keyValue key="sendFrom" value="receiver@priint.com"/>
</config>
</configs>

Email properties (sendFrom, sendTo) are resolved in order:

  1. Input params declared in the Camunda process
  2. Config defined in ISON

If no properties are found, the process throws an exception.

First priority

Second priority if first priority not found

SMTP Service​

Check your project's SMTP configuration before deploying.

If your mail server does not use SSL, remove or deactivate this property: mail.smtp.socketFactory.class

If authentication is not required, add this property: mail.smtp.auth: false and disable authorization.

User uploaded image

Parameters​

Publication Parameters​

Key prefix pp_: parameters with this prefix update the matching publication parameter, if it exists.

Other parameters replace placeholders in the template. Placeholders use the format {{name}}.

Example: Hello, {{camunda_user}}. becomes Hello, John.

Define it in the config as: <keyValue key="camunda_user" value="John"/>

For parameters with multiple values, use numbered suffixes:

  • pp_identifier_1 for value1
  • pp_identifier_2 for value2
  • pp_identifier_3 for value3

For a single value, use the key without a suffix:

  • pp_identifier

Document Parameters​

Key prefix dp_: parameters with this prefix update the matching document parameter, if it exists.

Other parameters replace placeholders in the template. Placeholders use the format {{name}}.

Example: Hello, {{camunda_user}}. becomes Hello, John.

Define it in the config as: <keyValue key="camunda_user" value="John"/>

For parameters with multiple values, use numbered suffixes:

  • dp_identifier_1 for value1
  • dp_identifier_2 for value2
  • dp_identifier_3 for value3

For a single value, use the key without a suffix:

  • dp_identifier

Send to All Users with Publication or Document Access​

All users and teams with permission to a publication or document will receive the email.

User uploaded image

All users will receive an email when the send email process is called. When used as a sub-process, provide the input parameter: sendEmailHavePermission.

The diagram shows the process running as a main process.

User uploaded image

This process generates a download link and sends the email in one step. Call it as a sub-process to include a download link in the email.

Diagram:

SKELETON_SEND_HTML_EMAIL

Required parameters:

Service taskParameter
Generate download linkbaseUrl → {{your domain}}/{{context-root from payara server}}/api/
expiration → 604800000
downloadPath → {{pathToDownload}}
Send EmailconfigId → {{configId in ISON}} (leave blank if already set from main process)

Example: Integrate with Web2Publish​

The email process can be integrated into any Camunda workflow. As an example, the following steps show how to send an email after a PDF has been rendered in a Web2Publish process (See Web2publish if you didn't install this part)

  • Adjust the render process by ADDING call activity and point to SKELETON_SEND_HTML_EMAIL process

integrate with render.png

  • In Mapping tab, enable Propagate all variables

  • In Input/Output tab, adding 2 properties in Input parameters

    • configId: {yourISONConfigId}
    • mainProcessInstance: ${execution.getProcessInstanceId()}
  • Re-deploy deploy Camunda process

  • Run the render process and verify that the email is sent.

integrate input output.png

Changelog​

VersionDescriptionReleaseDate
1.0Init documentrelease-1.0.017-Sep-2024
1.1Update diagramrelease-1.0.027-Sep-2024
1.2Add multiple configrelease-1.0.107-Nov-2024
1.3Create send email for document and send all users have access to publication/document have assignedrelease-1.0.113-Feb-2025
1.4Combine download link to send emailmain8th-Apr-2025