- Basic chapter: Sending an email with a fixed mail body to a fixed address
- Mail body chapter: Changing the mail body of an email using Embedded Commands
- Address embed chapter: Changing the address of an email using Embedded Commands
Change Email Addresses Using Embedded Commands
With procedures mentioned in “Basic chapter” and “Mail body chapter,” you can now flexibly generate and send the subject and body of the email in a Process. In the “Address embed chapter” I’ll introduce how to dynamically change the addressee (To) and the sender (From). Since I will continue to instruct you to add changes to the “Throwing Message Intermediate Event (Email) test” App as before, please open the modeler.
Specify the Process Start User
First, let’s make settings to send an email to the Process Start User.
When you embed “Process Start User” to the email body it turns into a username, but in addressee (To) it turns into a string of the name-addr format. That format is the syntax of the “username
When a Throwing Message Intermediate Event (email) is executed in this state an email from “firstname.lastname@example.org” or “email@example.com” is sent to the Process Start User.
“Process start user” can even be embedded in Cc and Bcc. For example, if it is embedded in the “Cc” field a copy of the email will be sent to the Process Start User.
Specify User-type Data Item
Now let’s see how to specify an email address with the values in a Data Item entered at the Confirm Task. For Users registered in Questetra BPM Suite, you can specify an email address with a User-type Data Item. Let’s try sending an email by embedding the email address specified with the User-type Data Item into the “To” field.
Create a User-type Data Item and set its Data editing permission to ”Editable” at the “Confirm” Task. The Data Type would be better as a “Search Select Box”. Then you embed that Data Item in address (To) of “Throwing Message Intermediate Event (email)” and save and release the App.
For example, if you specify “Sumatra” at the “Confirm” Task an email will be sent to “Sumatra” as in the figure below.
Specify String-type Data Item
If you specify an Email address with String-type Data Item it doesn’t matter if Questetra BPM Suite has no email address information. Let’s create a String Data Item, set its Data editing permission to “Editable” at the “Confirm” Task, and embed it to the addressee (To) of the “Throwing Message Intermediate Event (email)”.
If you set a String-type Data Item to be editable in Human Task Properties it will enable you to input in the text box. Therefore, if the address (To) is embedded with a String-type Data Item the Process Start User can freely enter any email address.
Also, by selecting “Text Box multiple lines” in the String-type Data Item it enables you to specify multiple email addresses in each field of the “Throwing Message Intermediate Event (email)”. If you enter multiple email addresses with the new-line delimited, it will be sent as the one below.
Specify multiple Data Items
You can specify multiple email addresses by embedding multiple Data Items in one field. For instance, by embedding both a User-type Data Item “User” and “Process Start User” to the addressee (To) it results as follows.
Specify with Select-type Data Item
By selecting “Check Box” in the Data Type of a Select-type Data Item you can specify multiple email addresses using the following method.
Create a Select type Data Item and open the Choice Settings by clicking the “Edit” button. When you select “Specify individually below” you will be able to set the options manually. Let’s enter an email address into the Choice ID section and its name into the Label section as in the screenshot below. Consequently, the string that will be embedded in “Throwing Message Intermediate Event (email)” is “Label “.
Also, in order to enable multiple selections select “Check Box” in the Data Type.
The procedure – clicking the Data editing permission of the created Select-type Data Item, selecting Editable in the “Confirm” Task and embedding the Data Item in the “Throwing Message Intermediate Event (email)” – is common even in other Data types.
Save and release the App and Start its Process. For example, in the case of checking the “Sumatra” and “Canary” boxes, you can confirm that your choices are embedded in the name-addr format in the options list as in the following figure.
Specify the sender as a fixed value in the name-addr format
Finally, I will describe the address setting of the sender (From) when you enter a fixed value. As I’ve introduced the setting of the addressee (To), also the sender (From) can be specified using the settings in “Throwing Message Intermediate Event (email)”.
You can also specify indication by entering in accordance with the name-addr format as follows:
I recommend that you set a Sender Policy Framework (SPF) if you change the sender (From) to avoid emails sent by the App being identified as a spam email. By setting the SPF properly you can prove that “It is not a spam email” even when you send an email with your email address in Questetra BPM Suite.
SPF settings can be done by registering TXT records in the DNS of the domain which your email address uses. The setting method differs depending on the domain host, so please contact your service for the specific procedure. Please refer to the following article about the settings values.
In this article, I covered only the sender (From) and address (To) of the “Throwing Message Intermediate Event (email)”, but Data Embedding can be performed in Cc and Bcc as well. Please combine these to create the perfect App for your work!