E-mail Handling

Many applications need to work with e-mails: e-mails often need to be automatically sent under the appropriate circumstances (for example, to remind customers that their insurance policy is about to expire) and certain actions need to be automatically performed upon receiving e-mails (for example, automatically register a support request from a customer). The following section describes how this can be done in Aware IM.

Sending outgoing e-mails is a part of a communication between Aware IM and an external party, such as an individual or an organization. Communication between Aware IM and external parties is described in the Communication with Other Systems section. An outgoing e-mail represents a notification sent by an Aware IM –based application to an external party. The external party must be represented by an intelligent business object and must have a communication channel of the “e-mail” type defined. E-mail can be sent from business rules using the SEND action of the Rule Language.

There are, therefore, 3 steps involved in the configuration of an application that needs to send e-mails:

  1. Define an intelligent business object representing the addressee of the e-mail with the communication channel of the “e-mail” type.
  2. Define a notification representing a particular e-mail.
  3. Define a business rule that will use the SEND action to send the e-mail under the appropriate circumstances.

Step 1 is described in the Defining Intelligent Business Objects section. Once the channel has been defined Aware IM automatically adds the special attribute called EmailAddress to the definition of the intelligent business object. The value of this attribute is used by Aware IM to determine the e-mail address of the e-mail recipient when the e-mail is sent. The value of this attribute can be set on the form of the business object by the user or by rules.

Step 2 is described in the Adding/Editing Notifications and Sending Outgoing E-mail sections. When configuring a notification representing the e-mail it is important to define the Subject and Message attributes, the values of which will be used by Aware IM to specify the subject and body of the outgoing e-mail respectively. Also if the email has attachments the notification has to define attributes of the Document type – one attribute per attachment. The documents stored as values of these attributes will be used as e-mail attachments (see also Document Management).

Step 3 is described in the SEND action section of the Rule Language Reference. One point to note here is that it is not necessary to create the notification representing the email explicitly using the CREATE action – Aware IM will automatically create and initialize the notification before it is sent if it has not been created explicitly. Initialization expressions of the notification may use tag elements referring to the current Context (see Document Generation). For example, one could define the ExpiryEmail notification with the Message attribute initialized to the following text:

"Dear <<Customer.Name>>, your policy is about to expire".  

Then one could define the following rules:

FIND Customer WHERE Customer.Policy.ExpiryDate=CURRENT_DATE
 SEND ExpiryEmail TO Customer 

This is equivalent to the following:

FIND Customer WHERE Customer.Policy.ExpiryDate=CURRENT_DATE
 CREATE ExpiryEmail WITH 
    ExpiryEmail.Message='Dear <<Customer.Name>>, your policy is about to expire'
 SEND ExpiryEmail TO Customer 

Just like outgoing e-mails incoming e-mails are represented by a notification. Unlike outgoing e-mails there is only one notification that represents an incoming e-mail. Its name is IncomingEmail. The name and attributes of this notification cannot be changed.

Conceptually this notification is received by a business space, so to define this notification the configurator must indicate that the business space will be receiving incoming e-mails. This process is described in detail in the Setting Options for Incoming E-mail Handling section. Basically the configurator has to provide the name of the email server and the details of the e-mail account. After this Aware IM will automatically add the definition of the IncomingEmail notification to the business space.

Once the IncomingEmail notification has been added to the list of notifications it is up to the configurator to define business rules that will be triggered once the e-mail is received (see Data Processing). The rules may check the attribute values of the IncomingEmail notification and perform the appropriate actions. The attributes of the notification contain the date when the e-mail was sent, who it was sent from, the subject and the body of the e-mail etc. There are also three attributes of the Document type representing the e-mail attachments. The first two attachments (if present) are contained in the first two attachment attributes. If e-mail has more than two attachments all other attachments are zipped up and stored in the third attachment attribute.

Example of a rule attached to the IncomingEmail notification:

IF IncomingEmail.Subject = 'Support Request' THEN 
 CREATE SupportRequest WITH 
   SupportRequest.Contents = IncomingEmail.Message 

This rule creates the business object SupportRequest initialized to the body of the received e-mail.

The SET action of the Aware IM Rule Language can be useful for analysing the received e-mail provided that the body of the e-mail is in a format required by the SET action.

  • Last modified: 2022/09/13 18:15