com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.

Working with Mail Tasks

The following scenario simulates a simple leave approval business process, in which an employee fills a form and submits the leave request to the manager and the manager approves or rejects it. The employee receives an email if the manager approves the request. Otherwise, if the manager rejects it, the employee will be able to resend the leave request by adjusting it. 


Before you begin,

  • Download the product installer from here, and run the installer.
    Let's call the installation location of your product the <EI_HOME> directory.

    Note that if you used the product installer to install your product, the <EI_HOME> is located in a place specific to your OS as shown below:

    OSHome directory
    Mac OS/Library/WSO2/EnterpriseIntegrator/6.3.0
    WindowsC:\Program Files\WSO2\EnterpriseIntegrator\6.3.0\
    Ubuntu/usr/lib/wso2/EnterpriseIntegrator/6.3.0
    CentOS/usr/lib64/EnterpriseIntegrator/6.3.0
  • Select and download the relevant WSO2 EI tooling ZIP file based on your operating system from here and then extract the ZIP file.
    The path to this folder is referred to as <EI_TOOLING>throughout this tutorial.

    Getting an error message? See the troubleshooting tips given under Installing Enterprise Integrator Tooling.

Let's get started! This tutorial includes the following sections:

Importing artifacts 

If you did not try the Working with Exclusive Gateways tutorial yet, follow the steps below to import its artifacts as you will be extending on that.

  1. Download the pre-packaged project and extract it to a preferred location. This contains the artifacts of the Working with Exclusive Gateways tutorial. 
  2. Open the WSO2 EI Tooling environment.
  3. Click File, and click Import
  4. Expand the WSO2 category, select Existing WSO2 Projects into workspace and click Next.
  5. Click Browse, select the file you extracted and upload it.  
  6. In the Package Explorer, double click on the name of the BPMN diagram to view the BPMN artifacts you imported.

Creating new artifacts

The next step of the process is adding a Mail Task to send an email if the manager approves the leave request. Follow the steps below to implement this using BPMN artifacts.

  1. Right click on the connection arrow, which connects the Review leave request User Task to the End Event and click Delete.


  2. Drag and drop a Mail Task to the canvas.

  3. Click on the Mail Task, and change the value of the Name field to Send confirmation email in the General section of the Properties tab. 

  4. Hover your mouse pointer over the Exclusive Gateway, and click on the arrow icon (i.e., the Create Connection option) and connect it to the Send confirmation email Mail Task.
  5. Hover your mouse pointer over the Send confirmation email Mail Task, and click on the arrow icon (i.e., the Create Connection option) and connect it to the End Event.


  6. Click on the arrow, which connects the Exclusive Gateway to the Send confirmation email Mail Task and enter ${vacationApproved == 'true'} as the value for Condition in the Main config  section of the Properties tab.

  7. Press Ctrl+S to save all the artifacts, which you created in WSO2 EI Tooling.
    The model is now complete as the necessary logic has been applied.

Configuring the Send confirmation email Mail Task

  1. In the Main Config section of the Properties tab (of the Mail Task), fill the respective fields (i.e., ToFromSubject). You can give the Subject as Leave approved!.
  2. In the Non-HTML field of the Main Config section, enter Hi ${employeeName}, your leave request is approved. The variable will be used to create the mail body.

     More information on the properties of the Mail Task

    The Mail Task allows you to send an email within a BPMN Process. It is configured with the following properties. 

    Field NameMandatoryDescription
    ToYesThe email address of the intended recipient of the email. Multiple recipients can be specified as comma-separated email addresses.
    FromNoThe email address of the sender. If this field is not specified, the default email address specified in the activiti.xml file will be used.
    SubjectNoSubject of the email.
    CCNoThe email addresses of the carbon copy receivers of the email. Multiple recipients are separated by commas.
    BccNoThe email addresses of the blind carbon copy receivers of the e-mail. Multiple recipients are separated by commas.
    CharsetNoCharset of the email can be changed.
    HtmlNoThe content of email is in HTML format.
    TextNoContent is in non-HTML format.
  3. Copy the following JAR files into the<EI_HOME>/lib directory and restart the Business Process profile server instance. 

  4. In the <EI_HOME>/wso2/business-process/conf/activiti.xml file, add the following properties under the <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration"> property as shown below, to enable the Gmail configurations.

    • Replace the mailServerHost and mailServerPort property values as follows:

      <property name="mailServerHost" value="smtp.gmail.com"/>
      <property name="mailServerPort" value="587"/>
    • Add the following properties:

      <property name="mailServerDefaultFrom" value="<ENTER_A_VALID_SMTP_EMAIL_ADDRESS>"/>
      <property name="mailServerUseTLS" value="true"/>
      <property name="mailServerUsername" value="<ENTER_A_VALID_SMTP_EMAIL_ADDRESS>"/>
      <property name="mailServerPassword" value="<ENTER_THE_EMAIL_PASSWORD>"/>
       More information on the above properties
      PropertyDescription
      • <property name="mailServerDefaultFrom" value=”email of the sender”>
      This specifies the default address of the sender. If a sender is not specified in the sender field as a mail task property, the email address specified here will be used instead.
      • <property name="mailServerUsername" value="mailtask@gmail.com"/>
      • <property name="mailServerPassword" value="mailtask123"/>
      Specifies the credentials of the sender for authentication purposes. Here, you should include the email addressandit'scorrespondingpasswordwhich you specified in the “From” field of the mail task.
      • Port 456 (SSL required):<property name="mailServerUseSSL" value="true"/>
      • Port 587 (TLS required):<property name="mailServerUseTLS" value="true"/>
      Specifiy only one of these two properties in order to specify whether the mail server should use SSL or TLS.

      If you are using Gmail to try out this scenario, you may need to enable IMAP access for Gmail. For more information, see Enable IMAP settings in Gmail. Also, if you receive an authentication error, you may have to adjust your account access settings in Gmail as well. For more information, see Allowing less secure apps to access your account.

Deploying the artifacts

  1. For instructions on creating the deployable artifacts, see Creating the deployable archive.
  2. For instructions on deploying them, see Deploying BPMN artifacts.

Creating the user

  1. Log in to the Management Console of the Business Process profile.
  2. Click Configure → Users and Roles → Add → Add New User.
  3. Enter the below details to create a user called manager and click Next.

    Enter both the User Name and the Password as manager.


  4. In the next screen, assign the user to the admin role and click Finish.

    You view the new user you created as shown below.

Testing the output

Follow the steps below to test the output.

  1. Log in to the BPMN-explorer at https://localhost:9445/bpmn-explorer using admin for both the username and password.
  2. Click PROCESSES in the top menu, and click the Start option of the Leave Approval Process.
  3. Initiate the process by filling the form and click Start.

    You view a pop-up message upon successful process initiation.

  4. Initiate the process again by filling the form again and click Start.

    You create two tasks to test the output of both leave approval and leave rejection. 


  5. Log out and log in again using manager/manager credentials. 
  6. Click TASKS and then click MY TASKS. You view two tasks created.
  7. Click on the first task, select Approve from the drop down list and click Complete Task.


    An email will be sent to the employee confirming that one of your leave requests was approved by the manager.


  8. Click TASKS and then click MY TASKS again, click on the second task, which is left now, select Reject from the drop down list and click Complete Task.

  9. Log out and log in again with admin/admin credentials, and click TASKS → MY TASKS
    You view the Adjust vacation request Task.

  10. Click on the Adjust vacation request Task, change the details and click Complete Task to resend the leave application. 

  11. Log out and log in again with manager/manager credentials, and click TASKS → MY TASKS.
  12. Click on task, select Approve from the drop down list and click Complete Task
    Another email will be sent to the employee confirming that your second leave request was also approved by the manager.

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.