Help files

Retrieve Exchange Email Messages Action

Description:

This Action retrieves email messages from an Exchange server.

Retrieve_Exchange_Email_Messages_Image_2a.png

Messages can be filtered based on various criteria, such as the sender's address, the Exchange folder or even the existence of specific keywords in the body, subject or other fields of the email.

Note that this Action will mark the retrieved emails as read on the server. If you wish to keep the emails marked as unread you can change their state back to unread through the "Process Exchange Email Messages" Action. Only the messages that match all of the filters set in the action will be included in the retrieval and marking.

Properties:

Exchange Connection:

Enter the Variable that contains your Exchange connection. Exchange connections can be created using the "Connect To Exchange Server" Action.

Exchange Folders:

Select a predefined Exchange Folder to retrieve email messages from or add a custom one.

Retrieve:

In the Retrieve property, you can specify whether you want to retrieve all messages from the Mail Folder, or just the unread ones. This could be important especially when the Retrieve Emails Action is to be performed periodically and you want to get feedback on only the updated conversations and unread emails from your mailbox.

retrieve property - retrieve emails.png

"From" Field Contains:

Enter the full e-mail address of the Sender whose messages you want to retrieve. Leave this field blank to retrieve all messages regardless of the sender.

"To" Field Contains:

Enter the full e-mail address(es) of the Recipient(s) (separated by space if more than one) for the messages you want to retrieve. Leave this field blank to retrieve all messages regardless of the recipient(s).

"Subject" Field Contains:

Enter the key phrase to be found within the email Subject. Leave this field blank to retrieve all email messages regardless of their subject.

"Body" Field Contains:

Enter the key phrase to be found within the email Body. Leave this field blank to retrieve all email messages regardless of their content.

Of course, as with any other property in WinAutomation, you have the option to define your criteria on all "Contains" properties using Process Variables. You can, for example, set the “From Contains” property to get its value from a variable where you have stored email address information of the customers that bought a specific product and you want to retrieve any feedback provided by them:

from field variables - retrieve email.png

With this setting the Retrieve Action will search your specified Mailbox (or your email server inbox if not otherwise specified) for any emails sent by any of the email addresses stored as the values of this Variable (unread or all according to your preference) and retrieve them.

The use of Variables as the values of the Sender’s and/or Receiver’s properties also gives you the option to include the Retrieve Email Messages Action in a Loop Section of a Process and iteratively check and retrieve emails for each one of this group of email addresses.

Attachments:

Specify whether you want to save the attachments of the emails retrieved or not.

Save attachments into:

Enter here the folder in which you want the attachments to be saved. WinAutomation will save all the attachments of the retrieved emails to the same (specified) local folder. In the case that more than one emails have the same name, WinAutomation will rename them by appending a 4-digit suffix. For example, if there is already a file named OrderForm.doc in the destination folder, the next attachment of a retrieved email also named OrderForm.doc that is to be saved, will eventually be saved as OrderForm_0001.doc.

Furthermore, as you may see below in the Mail Message Variable Properties, each retrieved email variable is accompanied by a list of its attachments that are saved locally (represented by the attachments property) to which you can refer in order to track the email to which each file was attached to.

Save Emails into:

Enter a name to be the variable that will store the retrieved email messages for later processing. The variable will contain a List of Exchange Mail Messages objects.

The outcome of the Retrieved Emails Action (%RetrievedEmails%) will be a List of Mail Messages variable. As every list variable, its only property is “Count” that has as value the number of the retrieved emails according to our selections in the Retrieve Emails Action properties fields:

retrieved email variable properties (count).png

Each item of this list will be a Mail Message object. Since %RetrievedEmails% Variable is a list type variable, each item of the list (i.e. each email) can be described by the following notation: %RetrievedEmails[n]%with n referring to the index of each retrieved email of our action (e.g. 0 for the first retrieved email, 1, for second).

Each Mail Message (included as an item in the List of Mail Messages) is itself a variable with the respective properties (populated by the Retrieve Emails action).

You can retrieve any of each email’s properties and use it as input in an action’s properties by following the general notation:

%VariableName.PropertyName%

For example, if you want to retrieve the Subject of the third retrieved email, you should use the notation:

%RetrievedEmails[2].Subject%