# <H1 align="center">«Read emails» module </h1> 

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

## Module interface
<p> Module consists of two tabs: «Settings» and «Reading settings».  
<p> 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»). 
<H1 align="center">![Screenshot](img/RE_1.png)</h1> 
<H1 align="center">![Screenshot](img/RE_2.png)</h1> 
### Tab «Reading settings»
<p> The «Reading settings» tab is a set of fields that is filled, depending on the type of emails the robot needs to read.
<H1 align="center">![Screenshot](img/RE_3.png)</h1> 
<p> 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:
<p> 1)	Subject – the subject of the email;
<p> 2)	Body – the body of an email, its main text;
<p> 3)	Sender – the sender of a letter;
<p> 4)	Attachments – list of paths to the downloaded attachments. 
<p> Examples of working with variables
<p> ●	@mail[1].Attachments[0] – getting the path to the first attachment of the second email.
<H1 align="center">![Screenshot](img/RE_4.png)</h1>
<p> ●	@mail[0].Subject – getting the subject of the first downloaded message :
<H1 align="center">![Screenshot](img/RE_5.png)</h1>
<p> 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.
<p> The «Only unread» checkbox allows scanning only unread emails. Available only for IMAP protocol.
<p> The «Mark as read» checkbox allows setting a note about reading an email. Available only for IMAP protocol.
<p> 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.
<p> 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:
<H1 align="center">![Screenshot](img/RE_6.png)</h1>
<p> 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.
<p> The following filtering methods are available: 
<p> ●	for a certain date – «On data»; 
<p> ●	starting with some data, including it – «With data»;
<p> ●	all letter up to some date, including it – «To data»;
<p> ●	«Between date». 
<p> 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.
