Read emails

Description

Reads messages from an email starting from a specified date. The 'Save value to variable' block appears automatically when choosing the 'Read emails' function. It automatically saves the value to a variable. However, the block is not mandatory to use and can be removed from the workflow.

Parameters

User email

  1. Set a value: enables you to directly write the email to read messages from.

  2. Save the previous step result: chooses the previous function result as an email.

  3. Calculate a value: enables you to use available properties and methods to form an email.

Server settings

Enables you to specify the server settings that is used for emails exchange.

  1. Custom: allows you to manually select the 'IMAP' or 'POP3' protocol, type the server address in the 'Server host' field and choose a secure connection.

  2. Yandex: default setting for the 'Yandex' server are applied.

  3. Google: default setting for the 'Google' server are applied.

  4. Yahoo: default setting for the 'Yahoo' server are applied.

  5. Mail.ru: default setting for the 'Mail.ru' server are applied.

  6. iCloud: default setting for the 'iCloud' server are applied.

User password

Enables you to enter a password from the email messages will be read from.

Date from

  1. Set a value: enables you to directly write set the date to start reading messages from. A calendar appears upon clicking the corresponding field to let you choose the date manually.

  2. Save the previous step result: chooses the previous function result as the date.

  3. Calculate a value: enables you to use available properties and methods to form the date.

Attachment

Download attachments

Enables you to download all attachments from mails that are being read starting form a certain date.

Directory path template

The parameter is available only if the 'Download attachments' option is checked. The folder where files will be downloaded is to be specified. By adding keywords {{date}} or {{subject}} a robot will automatically create subfolders with the mail's date or subject. Both keywords can be used at the same time.

  1. Set a value: enables you to directly write the folder path, for example, C:\electroNeek\ or C:\electroNeek\{{date}}\{{subject}}.

  2. Save the previous step result: chooses the previous function result as the folder.

  3. Calculate a value: enables you to use available properties and methods to form the folder.

Comment

Contains an annotation to the block. The input text will be displayed inside the block above the function name.

Result

The read emails are stored in the email_messages variable by default. The variable represents an array of object where one object corresponds to one email message. This object contains the following keys and values

Keys and values of an object from the array of objects containing emails
{
"textPlain": "this email's text returned by the server",
"text": "this email's text processed with an html-parser",
"attachments": [
{
"path": "path to the first attachment"
},
{
"path": "path to the second attachment"
}
"subject": "this particular email's subject",
"to": [
{
"name": "receiver's name",
"address": "receiver's email address"
}
],
"replyTo": [
{
"name": "name from the 'reply-to' section of this email",
"address": "email address from the 'reply-to' section of this email"
}
],
"receivedDate": "time when this email has been received",
"date": "time when this email has been sent",
"from": [
{
"name": "sender's name",
"address": "sender's email address"
}
]
}

Usage Examples

This function can be used everytime you need to read email messages. For example, you can configure your algorithm the way that a message sent to the email you are reading would be a trigger to start executing a certain part of your program.