Description:

Consumes messages from Email Server using IMAP protocol. The raw-bytes of each received email message are written as contents of the FlowFile.

Tags:

Email, Imap, Get, Ingest, Ingress, Message, Consume

Properties:

In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, whether a property supports the Expression Language Guide, and whether a property is considered “sensitive”, meaning that its value will be encrypted. Before entering a value in a sensitive property, ensure that the nifi.properties file has an entry for the property nifi.sensitive.props.key.

Name Default Value Allowable Values Description
Host Name Network address of Email server (e.g., pop.gmail.com, imap.gmail.com . . .)
Supports Expression Language: true
Port Numeric value identifying Port of Email server (e.g., 993)
Supports Expression Language: true
User Name User Name used for authentication and authorization with Email server.
Supports Expression Language: true
Password Password used for authentication and authorization with Email server.
Sensitive Property: true
Supports Expression Language: true
Folder INBOX Email folder to retrieve messages from (e.g., INBOX)
Supports Expression Language: true
Fetch Size 10 Specify the maximum number of Messages to fetch per call to Email Server.
Supports Expression Language: true
Delete Messages false * true
* false
Specify whether mail messages should be deleted after retrieval.
Connection timeout 30 sec The amount of time to wait to connect to Email server.
Supports Expression Language: true
Mark Messages as Read false * true
* false
Specify if messages should be marked as read after retrieval.
Use SSL true * true
* false
Specifies if IMAP connection must be obtained via SSL encrypted connection (i.e., IMAPS)

Relationships:

Name Description
success All messages that are the are successfully received from Email server and converted to FlowFiles are routed to this relationship

Reads Attributes:

None specified.

Writes Attributes:
None specified.

State management:

This component does not store state.

Summary:

This Processor consumes email messages via IMAP protocol and sends the content of an email message as content of the Flow File. Content of the incoming email message is written as raw bytes to the content of the outgoing Flow File.

Different email providers may require additional Java Mail properties which could be provided as dynamic properties. For example, below is a sample configuration for GMail:

Processor’s static properties:

Host Name - imap.gmail.com

Port - 993

User Name - [your user name]

Password- [your password]

Folder - INBOX

Processor’s dynamic properties:

mail.imap.socketFactory.class - javax.net.ssl.SSLSocketFactory

mail.imap.socketFactory.fallback - false

mail.store.protocol - imaps

Another useful property is mail.debug which allows Java Mail API to print protocol messages to the console helping you to both understand what’s going on as well as debug issues.

For the full list of available Java Mail properties please refer to here

How to configure?

Step 1: Drag and drop the ConsumeIMAP processor to canvas.

Step 2: Double click the processor to configure, the configuration dialog will be opened as follows,

properties

Step 3: Check the usage of each property and update those values.

Properties and usage

Host Name: Enters the network address of the email server.

Port: Specifies the port number of the email server.

User Name: Specifies user name for the email server.

Password: Specifies password for the email server.

Folder: It is used to specify the folder name from which the messages should be retrieved.

Fetch size: It is used to specify the maximum number of the messages that can be fetched from mail server for each call.

Delete Messages: Specifies whether the messages should be deleted or not from mail server once it is retrieved.

Connection timeout: Specifies the maximum amount of time to wait for connecting with email server.

Mark Messages as Read: Specifies if messages should be marked as read after retrieval.

Use SSL: Specifies if IMAP connection must be obtained via SSL encrypted connection.

For example, if you want to read emails retrieved from Gmail account, you should follow the below configuration.

To enable less secure app access for your Gmail account, go to [https://support.google.com/accounts/answer/6010255?hl=en](https://support.google.com/accounts/answer/6010255?hl=en# “”)

sample