Scripts of Type Email

Scripts of this type are used for several features. Some of the scripts are part of the default system configuration and have to be modified according to the customer-specific system configuration. You can also add your own scripts.

IMPORTANT INFORMATION

Since ConSol CM version 6.9.4, there are two modes to receive incoming emails:

For all configurations/settings which are valid for both modes, no further notes are added. For all settings which vary depending on the mode, this will be explained in separate (i.e., Mule/ESB- or NIMH-specific) sections.

Email Scripts for the Processing of Incoming Emails in Mule/ESB Mail Mode

Please note that Mule/ESB is deprecated in CM versions 6.11 and up!

When an email is received by ConSol CM, it is processed by several scripts, see following figure.

Figure 418: ConSol CM Admin Tool - Email scripts (Mule/ESB Mail)

Please note that the following scripts are part of the Mule/ESB mailing system which is deprecated in ConSol CM version 6.11 and up. Thus, you might find these scripts in systems which have been or have to be updated from a lower version to 6.11, but never in newly installed CM 6.11 systems.

Email Scripts for the Processing of Incoming Emails in NIMH Mode

When an email is received by ConSol CM, it is processed by several scripts, see following figure.

Figure 419: ConSol CM Admin Tool - Email scripts (NIMH)

Differences between Scripts in Mule/ESB Mail and NIMH

When NIMH is enabled, different Groovy classes have to be used in the email scripts than when using Mule/ESB Mail mode. Please see the mapping in the table below.

Mule

NIMH

where required:

import com.consol.cmas.esb.mail.MailContextService

where required:

import com.consol.cmas.nimh.extension.MailSupportService

import com.consol.cmas.nimh.common.model.MailHolder

mailContextService

mailSupportService

msg

with respective methods, example:

mailLog.info("Routing " + msg.getUniqueId())

mailHolder

with respective methods, example:

mailLog.info("Routing " + mailHolder.getUid()

mailLog

mailLog

spring cm services

spring cm services

all places where mailHolder is used

Example: see Example OLD below

pipeContext (used as parameter in mailSupportService invocations)

Example: see Example NEW below

pipeContext is an object of class MailPipeContext

msg.setProperty(...)

pipeContext.setAttribute(...)

esb endpoints in mail routing script ("target handlers"):

endpoints["esb_mail_mailToClosedTicketEndpoint"]

endpoints["esb_mail_appendToTicketEndpoint"]

endpoints["esb_mail_createTicketEndpoint"]

script endpoints in mail routing script ("target handlers"):

endpoints["mailToClosedTicketScript"]

endpoints["appendToTicketScript"]

endpoints["createTicketScript"]

Example OLD:

String email = mailContextService.extractMailFromField(msg)

Example NEW:

String email = mailSupportService.extractMailFromField(mailHolder, pipeContext)

The steps you have to perform when you want to switch your ConSol CM system from Mule/ESB Mail mode to NIMH mode are described in section Switching from Mule/ESB Mail to NIMH.

Email Scripts for Outgoing Emails

For every queue, an Email script can be configured. Please see section Queue Administration for an explanation how to configure this. An email which is written from a ticket in this queue (automatically by the workflow or manually by an engineer) passes through this script before it leaves the ConSol CM system. So in this Email script you can change or set queue-specific settings for the outgoing email. A common use case is the setting of a queue-specific Reply-To address in order to use team-specific Reply-To addresses.

An example of an outgoing Email script is the following script which is part of the ConSol CM default application:

Within the outgoing Email script, the Java object mailEntry is implicitly available as the object mail. You have to set all required attributes for the outgoing email using the mail.setAttribute() or mail.setAttributes() methods.

def queueReplyAddress = "serviceteam@mycompany.com"

// you might also use system properties for the queue-specific email addresses and fetch an

// address using the configurationService!

 

mail.setAttribute('Reply-to', queueReplyAddress)

Code example 67: Email script

Common email attributes are:

For a very detailed description of the email format, please refer to RFC 5322.

When you work with the configuration of the Reply-To email address, please note the following technical behavior of ConSol CM and adapt your system accordingly!

The technical background:

There are four potential Reply-To addresses which you deal with:

  1. The Reply-To address which is set with the system property mail.reply.to. If it is set, it will be displayed in the Ticket Email Editor in the Web Client. If it is really the effective Reply-To address in an email depends on the configuration in the queue-specific outgoing email script. See next item. If the Page Customization attribute showReplyTo for the type mailTemplate is set to false, no Reply-To address will be displayed in the Ticket-Email-Editor, but if the property mail.reply.to is set, this address will be used anyway - unless an outgoing mail script sets another address, see next item.
  2. The Reply-To address which is set in a queue-specific outgoing email script. Since the outgoing email script is the last instance which processes an outgoing email, the Reply-To address set in this script will always be the effective Reply-To address which is used. In case the mail.reply.to property is set, this mail-reply.to-address will not really be used (but it will be displayed in the Ticket Email Editor which might cause some confusion! What that means for your system configuration is explained in the next section).
  3. The email address which is set in the system property mail.from. If this is set and neither mail.reply.to nor a queue-specific Reply-To address is set, most email clients will set the From address as Reply-To address.
  4. The email address of the current engineer (the engineer who is logged in to the Web Client). This personal email address is used as Reply-To address for emails from the Web Client if neither the mail.reply.to property is set nor a queue-specific outgoing email script is configured nor the mail.from property is set.

In the Web Client, in the ticket history, the Reply-To address which was really used is always displayed for outgoing emails. So even in case there should be a difference between the address which was displayed in the Ticket Email Editor (the mail.reply.to property) and the Reply-To address which was really used (the Reply-To in the queue-specific outgoing email script), the effective address is displayed. This would be the one from the script in this case.

What we recommend:

A system Reply-To address should always be set! You can decide if you

or

However, since the email communication should take place via ConSol CM and not using personal email addresses, one of the two system settings mentioned above should be used to prevent CM from using personal email addresses as Reply-To. The latter would automatically lead to customer emails being sent to an engineer's personal email account instead of CM.

What that means for your system configuration:

  1. The simplest way to set a Reply-To address is by using the mail.reply.to system property. It will be displayed in the Ticket Email Editor and will be the effective Reply-To address.
  2. If queue-specific Reply-To addresses are required, we recommend to write one outgoing mail script where queue names are mapped to specific Reply-To addresses. This can then be extended for Bcc, Cc or other addresses.
    You can combine the mail.reply.to property and queue-specific Reply-To addresses: for all queues without a specific outgoing mail script, the mail.reply.to address will be used, for all queues which have a queue-specific outgoing mail script that contains a Reply-To address, this will be used.

What that means when you work with workflow scripts which send emails:

(A detailed explanation is provided in the ConSol CM Process Designer Manual!)

If neither the system property nor the queue-specific outgoing email script is used, i.e. when the Reply-To address is not set, usually the From address will be used as Reply-To by the email client.