Get message Version 6 (Java)
Action group: Email
Description
The action reads emails that match the specified filters from the mailbox and saves them to the Table type variable.
Action icon
Action parameters
Input parameters
"Context" field - email connection context identifier.
"From" field - selects emails whose sender email address fully matches or contains the provided value.
"To" field - selects emails whose recipient’s email address fully matches or contains the provided value. To specify more than one item, use ";" or ",".
"CC" field - selects emails whose addresses of the recipients of the email copy fully match or contains the provided value. To specify more than one item, use ";" or ",".
"Subject" field - selects messages whose subject line fully matches or contains the provided value.
"Body" field - selects emails for which the text of the email body fully matches or contains the provided value.
"Attachment name" field - selects messages with attachment names fully match or contains the provided value.
"Unread only" field - if "true", only unread emails will be selected. If the value is "false", both read and unread e-mails will be selected.
"Count" field - the number of emails that must be read from the mailbox using the specified filters.
"Folder For Attachment" field - the path to the folder in which subfolders will be created to save attachments from letters.
"Include html text" field - if the value is "true", the action will return an email text with full information about the styles of that text . If the value is "false", the action will return plain text.
"Search by template" field - if the value is "true", the values in the search filters will be treated as regular expressions when selecting emails. If the value is "false", the values in the search filters will be considered as plain text, and the search speed will also increase when connecting with IMAP protocol.
"Starting date" field. Not mandatory. Description: "The messages that are received starting from the specified date and time will be selected". Data type: Date-Time.
"Ending date" field. Not mandatory. Description: "Messages received before the specified date and time inclusive will be selected". Data type: Date-Time.
Output parameters
Result - A table into which information is saved from letters selected by the selected filters. The table has the following set of columns: ID - message identifier; From - sender; To - recipient (list of all); CC - recipient of a copy of the letter; Subject - subject of the letter; Body - the body of the letter; Path - path to the folder with the attachment files. DateTime - received date and time.
"Number of messages" field - the number of messages found.
Settings
Property | Description | Type | Filling example | Mandatory field |
---|---|---|---|---|
Parameters | ||||
Context | Email connection context identifier | Robin.JavaMail | Yes | |
From | Selects emails whose sender email address fully matches or contains the provided value | Robin.String | No | |
To | Selects emails whose recipient’s email address fully matches or contains the provided value. To specify more than one item, use «;» or «,» | Robin.String | No | |
CC | Selects emails whose addresses of the recipients of the email copy fully match or contains the provided value. To specify more than one item, use «;» or «,» | Robin.String | No | |
Subject | Selects messages whose subject line fully matches or contains the provided value. | Robin.String | No | |
Body | Selects emails for which the text of the email body fully matches or contains the provided value. | Robin.String | No | |
Attachment name | Selects messages with attachment names fully match or contains the provided value | Robin.String | No | |
Unread only | Selects unread emails only | Robin.Boolean | true | No |
Count | The number of emails that must be read from the mailbox using the specified filters. | Robin.Numeric | No | |
Folder For Attachment | The path to the folder in which subfolders will be created to save attachments from letters. | Robin.FolderPath | C:\doc\img | No |
Include html text | Include full body with html tags if applicable | Robin.Boolean | true | No |
Search by template | If «true» search by provided template, if «false» search as substring | Robin.Boolean | true | No |
Starting date | The messages that are received starting from the specified date and time will be selected. | Robin.DateTime | No | |
Ending date | Messages received before the specified date and time inclusive will be selected. | Robin.DateTime | No | |
Results | ||||
Result | A table into which information is saved from letters selected by the selected filters. The table has the following set of columns: - ID - Message identifier; - From - Sender; - To - Recipient (list of all); - CC - Recipient of a copy of the letter; - Subject - Subject of the letter; - Body - The body of the letter; - Path - Path to the folder with the attachment files. - DateTime - received date and time | Robin.DataTable | ||
Number of messages | The number of messages found. | Robin.Numeric |
Special conditions of use
None.
Example of use
Task
Get all messages from testsforrobin@mail.ru with subject "Employee" and PNG-files in the attachments. Files from the messages to save to the folder.
Solution
Connect the mailbox from which you want to receive emails. For any actions with a particular mailbox, connect to it first, create its unique identifier (Context).
Define the mail service. (Connection parameters to the mailbox depend on the mail service).
Get emails matching the specified filters.
Implementation
- Assemble a robot scheme withe the actions:
- Set the "Open email" action parameters. (for action description go to Настройки подключения / Connection settings).
Настроить параметры для действия "Получить сообщение".
Настройка действия:a. параметр "Контекст". Необходимо выбрать из выпадающего списка контекст соответствующий почтовому ящику с которого будут вычтены сообщения;
b. параметр "От". Указываем почтовый ящик отправителя сообщения;
c. параметр "Кому". Указываем почтовый ящик получателя сообщения;
d. параметр "Тема". Указываем значение "Сотрудник";
e. параметр "Название вложения". Указываем маску файлов. ".png";
f. параметр "Папка для сохранения вложений". Указываем путь до папки, в которую будут сохранены вложения
g. Параметр "Начиная с даты". Указываем дату, поиск с которой будет осуществлен с даты/времени указанных в "Начиная с даты" и до даты/времени указанных в "Заканчивая датой" включительно.
h. Параметр "Заканчивая датой". Указываем дату, поиск до которой будет осуществлен с даты/времени указанных в "Начиная с даты" и до даты/времени указанных в "Заканчивая датой" включительно.
i. параметр "Результат". Указываем переменную "Таблица", в которую будет сохранена информация из писем.
- Нажать на кнопку "Старт" в верхней панели.
Результат
Требуемые письма получены и сохранены в таблицу, в которую сохраняется информация из писем, отобранных по выбранным фильтрам. Вложения из писем сохранены в целевую папку.