«Read emails» module

The «Read emails» module is intended for getting a list of emails from a mail agent for further processing or just to download attachments.

Module interface

Module consists of two tabs: «Settings» and «Reading settings».

The «Settings» tab is similar to the tab with the same name in the «Send email» module, it has only one difference - this module provides the selection of sending protocols: IMAP or POP3. When you select the protocol the fields «Host», «Port» and «Use SSL» are filled automatically (except «User settings»).

![Screenshot](img/RE_1.png)

![Screenshot](img/RE_2.png)

### Tab «Reading settings»

The «Reading settings» tab is a set of fields that is filled, depending on the type of emails the robot needs to read.

![Screenshot](img/RE_3.png)

Field «Variable». The field is intended for entering the name of a variable, in which the information about the read emails is gonna be put in. In the program, this field will be represented by a list of objects that have four fields:

1) Subject – the subject of the email;

2) Body – the body of an email, its main text;

3) Sender – the sender of a letter;

4) Attachments – list of paths to the downloaded attachments.

Examples of working with variables

● @mail[1].Attachments[0] – getting the path to the first attachment of the second email.

![Screenshot](img/RE_4.png)

● @mail[0].Subject – getting the subject of the first downloaded message :

![Screenshot](img/RE_5.png)

The «Download attachments into the folder» field is intended to enter the path to the folder into which all attachments of the read emails will be loaded. If you leave the field empty, the files will be downloaded to the temporary directory of the computer.

The «Only unread» checkbox allows scanning only unread emails. Available only for IMAP protocol.

The «Mark as read» checkbox allows setting a note about reading an email. Available only for IMAP protocol.

The «Read from folder» field is intended for a specified folder in the inbox from which the emails should be read. By default the robot reads emails from the «Inbox» folder. Available only for IMAP protocol.

The «Message topic filter» field is used to configure the filter by message topic. If you need to download emails with a topic that does or does not contain a specific line, then you should select the operation of the same name in the drop-down list and enter the desired line in the field that appears:

![Screenshot](img/RE_6.png)

The «Date filter» field is used to configure filtering of reading messages by date. When specifying a value in this field, the robot will read only those messages that satisfy the specified condition.

The following filtering methods are available:

● for a certain date – «On data»;

● starting with some data, including it – «With data»;

● all letter up to some date, including it – «To data»;

● «Between date».

After selecting a filtering method, one or two fields will appear under the «Filter by date» field to enter the desired values in the format DD.MM.YYYY.