Wait for Email Activity
- Last UpdatedJun 21, 2024
- 7 minute read
Activity description:
The Wait for Email Activity can be used to wait for a number of emails for a particular time period, both of which can be set in the activity's properties. It can also be used to filter incoming mails using specific conditions set in the properties. It can store emails (completely or partially) into specified variables. Options to save attachments, including the location to save, can also be specified. Depending on different property settings the activity will give different outputs.
See Localizing the response sent for an invalid email to the Communication Engine for more information on localizing an email.
Variables for capturing EmailIds
To get Email Id of the last received mail, use the System variable. The variable name has to be prefixed with "@"+CurrActivity.Name + "^MailID".
For example, If activity name is Waitforemail1, then variable name should be "@ Waitforemail1^MailID".
Note: The use of System variable CurrActivity.Name + "^EMailID" has been retained to ensure backward compatibility. For example, If activity name is Waitforemail1, then variable name should be "Waitforemail1^EMailID".
Activity Properties:
The Wait for Email activity has to be configured by specifying appropriate values for the different properties in the Activity Properties area. The Activity Properties can be accessed by clicking on the Activity Properties tool in the Tool Bar or by selecting the appropriate option from the right click menu for the Wait for Email activity. The Activity Properties are organized under the following groups of related properties. The properties under each group are described in this topic.
Name & Description
The properties in the Name & Description group have been described below. You can use these properties to specify the name and description for the activity.
Name - This property can be used to specify a name for the activity.
Property Type: Optional (This property needs to be set only if necessary.)
Description - This property specifies a brief description to be displayed for the activity.
Property Type: Optional (This property needs to be set only if necessary.)
Configuration
The properties in the Configuration group have been described below. You can use these properties to configure the functionality of the activity.
Filter Expression - This property is used to filter the incoming email. It will add an email filter. On execution, the SMTP Notification Engine will be notified about the newly added filter so that it will search for this pattern in the next email.
Property Type: Mandatory (This property must be set if the action is to be assigned to any resource(s).)
Steps to set the Filter Expression property
-
To set the condition to filter the incoming emails, click the button for the 'Filter Expression' property to open the property window.
-
In this window build an expression to set the filter. Select an attribute from the first drop down list, then select the operator, type of value (Value, Variable, Content, XMLVariables), and the corresponding value for the property from the corresponding drop downs. Select "End" from the last drop down to complete the expression. If you are building a compound expression, you can select one of the logical operators to connect the different conditions that form the expression.
-
Add the condition to the expression by clicking Add. This will display the expression in the text area.
-
You can remove a condition already added to the expression by clicking Undo.
-
You can also clear an existing expression if necessary by clicking Clear. This is useful if you want to clear large expressions in the text area in order to build a new expression.
-
After building the expression, click Update to save it.
See Wait for Email: Filter Expression for a detailed description of the Filter Expression property window.
Valid for Emails - This property is used to specify the number of emails for which the action should wait. It indicates that the action should wait till the specified number of emails are received.
Property Type: Optional (This property needs to be set only if required.)
Set Variables And Contents from Email - This property is used for assigning the email partly/ fully to a variable or content.
Property Type: Optional (This property needs to be set only if required.)
Steps to set the Set Variables And Contents from Email property
-
To set the filtered email can be to variables and contents, click the button for the 'Set Variables And Contents from Email' property to open the property window.
-
In this window, first select the variable from the Variable drop down.
-
Next specify the search criteria in the Search criteria field. You can either enter the regular expression directly or click on the Generate RegExp for Selected Row button to generate a regular expression.
-
If you click the Generate RegExp for Selected Row button it displays a set of fields and buttons at the bottom of the property window.
-
Specify the start string for the regular expression in the Start String field and Start and End delimiters in the corresponding text boxes of the Delimiters fields.
-
After specifying these values, click Generate to generate the regular expression.
-
Click Hide to hide these fields.
-
Specify where to search in by selecting an appropriate option from the Search in drop down. You can set the action to search in the entire email, the subject, and the attachments among other options.
-
Specify the name of a group to which the variable should belong in the Set variable in the named group field.
-
Click the New row tab to add the current search expression and display a blank row to add another expression.
-
If you need to remove any search expressions, you can select them and click Remove selected.
-
After specifying all the search parameters, click Update to save the new settings.
See Wait for Email: Set Variables And Contents from Email from Email for a detailed description of the Set Variables And Contents from Email property window.
Attachment Save Options - This property is used for setting the attachment saving options. The mail attachments can saved according to specified options. Filter attachments to save by searching for a string in the file name or file content.
Note:
- Attaching an email message as an attachment is not supported.
- Supported file types for attachment include .au,.avi,.bas,.bmp,.cdr,.drw,.dwg,.dxf,.eml,.eps,.gif,.ico,.img,.jpeg,.jpg,.log,.mid,.midi,.mov,.movie,.mp1,.mp2,.mp3,.mpeg,.mpg,.msg,.nws,.obd,.pcx,.pdd,.pdf,.pic,.pps,.pub,.qbb,.qbw,.qdb,.ra,.snd,.text,.tga,.tif,.tsv,
and .txt.
Property Type: Mandatory (This property needs to be set.)
Steps to set the Attachment Save Options property
-
To specify the attachment save options, click the button for the 'Attachment Save Options' property to open the property window.
-
Select the save option from the first drop down.
-
If you select "All Files", it will save all the attachment files
-
If you select "File Names" or "File Contents", it will save either the specified files or the specified contents of the attachment file. This will display the corresponding fields/drop downs to specify the parameters.
-
-
Select the type of value (Value, Variable, Content) from the second drop down, and specify the corresponding value for the property from the next text box (if "Value" is selected) or drop down.
-
Click Update to save the new option.
Note: In user specified location, you have to append the mail id i.e, if user specified location is "C:\WMMailAttachments\", then actual location will be "C:\WMMailAttachments\<mailId>" .
Example
Location : c:\Temp\
Actual: c:\Temp\123 –(123 is last mailid )
Location : c:\Temp
Actual: c:\Temp123 –(123 is last mailid )
See Wait for Email: Attachment Save Options for a detailed description of the Attachment Save Options property window.
Attachment Save Location - This property is used to specify the location in which to save the attachments.
Property Type: Optional (This property needs to be set only if necessary.)
Steps to set the Attachment Save Location property
-
To specify the location to save the attachment, click the button for the 'Attachment Save Location' property to open the property window.
-
Select the protocol to be used to save the file in the location from the 'Protocol' property.
-
Specify the path of the location in the Location property. Build an expression to assign the location details by selecting the operator, type of value (Value, Variable, Content, XMLVariables), and the value for the property from the corresponding drop downs.
-
In the same way, you can assign a search pattern to filter the type of file to be copied or transferred as the value for the Pattern field. For example, you can specify "*.doc" as the filter pattern. This will select only files with the extension .doc for copying or transferring.
-
You can also assign the user name and password of the source file/directory in the User Name and Password fields respectively, by following the same procedure that is used in step 3.
-
In addition, you can assign the domain name and port number of the source in the DomainName and PortNumber fields respectively, by following the same procedure that is used in step 3.
-
After adding the parameter, click Submit to save it.
See Wait for Email: Attachment Save Location for a detailed description of the Attachment Save Location property window.
Escalation & Timeout
The properties in the Escalation & Timeout group have been described below. You can use these properties to specify escalation and timeout settings for the activity.
Timeout Warning - This property is used for setting the Timeout warning.
Property Type: Optional (This property needs to be set only if required.)
Timeout for Action - This property is used for setting timeouts for this action. If specified, the action will be timed out after the specified time span.
Property Type: Optional (This property needs to be set only if required.)
Looping Behavior
The property in the Looping Behavior group has been described below. You can use this property to specify the looping behavior of the activity.
Loop through this action if output is - This property is used to specify the condition for looping the activity by selecting an activity output from the drop down.
Property Type: Optional (This property needs to be set only if necessary.)
Activity outputs:
The Wait for Email Activity returns the following values -
Timeout Warning: Displayed when a warning for timeout is to be generated
Email Received(Waiting): Displayed when an email matching the specified filter condition is received
Timeout: Displayed when the activity has timed out
Exception Behavior
Each activity has the Raise Error on Unhandled Linked Output property on click of which, it shows all the default configured mapped error outputs in red with their check boxes selected.
See Mapped Error Output for more details.