Support Import

Retrieve Emails Action

This Action retrieves email messages from an IMAP server.

Messages can be filtered based on various criteria, such as the sender's address, the IMAP 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 Emails Action. Only the messages that match all of the filters set in the action will be included in the retrieval and marking.


Mail Folder:

In the Mail Folder property, you can enter the name of the mail folder (also known as `Mailbox') that you want to retrieve messages from.

You can select to retrieve emails from your INBOX or from any other folder of your email account. To avoid confusion, you should keep in mind that in this action, by using the term “Mail Folder”, we refer to the folders of your email server and not to the folders where you store your files locally, in your PC.

If you have already set some values in the IMAP Server Properties Tab for this or a previous Retrieve Emails action in the Process, the drop-down menu will load and present you all the available folders from your email server. However, even if you have not already set IMAP Server properties, you can specify your preferred Mail Folder by just typing its name in the Mail Folder property (provided that when you execute this Process, the specified folder will exist in the email server).

mail folder - retrieve email.png


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 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 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 Contains:

Enter the keywords to be found within the email Subject. Leave this field blank to retrieve all emails regardless of their subject.

Body Contains:

Enter the keywords to be found within the email Body. Leave this field blank to retrieve all emails regardless of their content.

Of course, as with any other property in ProcessRobot, 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 Emails 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 Emails Action in a Loop Section of a Process and iteratively check and retrieve emails for each one of this group of email addresses.

Below we present you a part of a script that uses a variable (here named %Contacts%) as that input of "From Field Contains" property of Retrieve Emails Action, in order to retrieve emails sent by each one of a group of contacts and display a message informing you about the number of the unread messages you have from each one of them.

loop retrieve emails 1.png


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. ProcessRobot 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, ProcessRobot 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 e-mails for later processing. The outcome of the Retrieved Email 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:


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


Below you can see an example of how the Retrieve Emails Action can be used inside a loop. This section of the Process’s script will search and retrieve all unread emails from your Inbox that their subject contains the subtext "Order Form" (as specified in the Retrieve Emails Action Properties window). If any of the retrieved emails have attachments, those will be saved locally, inside the specified folder. For every matching email, this Process will append the corresponding emails of the sender(s) to a specific text file.

In other words, the final outcome of this Process will be a text file containing all the sender addresses of messages with a subject containing the text "Order Form"

retrieve email in loop 1 - retrieve email.png

Note that in order to record only the Sender’s address for each of the retrieved emails we used (as presented in the Properties of “Write Text to File” action window below) the notation:


requesting from this action to retrieve the value of the “From” property of the retrieved email used as an iterative variable  (%CurrentItem%) in each loop.


IMAP Server:

Enter the IMAP Server address here (e.g.,


Specify the port to be used for the IMAP Server. Usually, this is Port 993.

Enable SSL:

Specify whether you need to use a secure connection to communicate with the IMAP Server.

User Name:

Enter the User Name of the e-mail account you want to access.

Enter Password:

If you choose 'directly', the password entered in the Password field will be hidden. If you choose 'as variable' you must enter a variable containing the password and the '%' character will be treated as an indicator of a variable, not part of the password.


Enter the Password here. You may enter either a text, or a variable containing the password depending on the selection of the previous property (Enter Password).

Accept Untrusted Certificates:

Choose whether the server should accept untrusted certificates.