Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Field Name

Field Type

Field Dependency

Description

Label*

Default ValueEmail Reader
ExampleEmail Reader

String

None

Specify the name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your Pipeline.

Mail folder*

Default Value: Inbox
Example: Inbox

String/Expression

None

Specify the name of email folder where the Snap reads messages from.

Info

Ensure that you specify the folder name as it appears on the email client, because folder names might be case-sensitive for some email providers, such as Yahoo. Otherwise, the Snap displays Error retrieving folder for given source or destination error.

Unread only

Default Value:Selected
Example:Selected

Checkbox

None

Select this checkbox to inform Snap to read only the unread email messages. If you do not select this checkbox, the Snap reads all messages.

Note

 If this property is selected, the Snap does not execute during preview as the execution changes the state of the unread messages.

Number of messages

Default Value:All
Example:100

Integer

None

Specify the maximum number of messages that the Snap has to read. Any non-integer or negative value leads to "All" messages being moved.

Older message first

Default Value:Deselected
Example:Selected

Checkbox

None

Select this checkbox to view the older messages first in the output view. If you do not select this checkbox, the latest messages display first in the output view.

Attachment folder

Default Value:Shared
Example:smb://<username>@<hostname>:<port>/<directory>

String/Expression

None

Specify the URL of the directory where attached files are stored. If this property is blank, all attached files are ignored.

Note
  • This property is expression-enabled. For more information on the expression language, see Expression Language Overview and Expression Language Usage.

  • The user must have write access to the target folder listed in this field.

  • If the Attachment folder is in the SMB file protocol, the name of the file attached to the Email must not contain any of the following characters:  " \ / : | < > * ?

The following are the most commonly-used target directory values:

  • shared: The Snap writes attachment files to /<org>/shared/ 

  • /<org>/projects/<project>: The Snap writes attachment files to the specified project.

  • sftp://<username>@<hostname>:<port>/<directory>:The Snap writes attachment files to the specified directory.

  • smb://<username>@<hostname>:<port>/<directory>: The Snap writes attachment files to the specified directory.

  • smb://<domain>;<username>@<hostname>:<port>/<directory>: The Snap writes attachment files to the specified directory. if the SMB credential has a Domain field, there should be a semicolon used as a separator between <domain> and <username>.

  • For SFTP and SMB paths, the password should be entered into the Attachment password property in the email account.

Examples:

  • sldb:///snaplogic/projects/attachments

  • $attachmentFolder

  • sftp://mrtest@sftpmrtest@ftp.snaplogicxyz.com/home/mrtest/new/

  • smb://mydomain;snapuser@54.159111.200223.139111:445444/snapuser/

File action

Default ValueOVERWRITE
Example: RENAME

Dropdown list

None

Select an action to be taken if a file with the same name as in the email attachments exists in the specified directory. The available options include:

  • OVERWRITE

  • RENAME

  • IGNORE

  • ERROR

If ERROR is selected, the Snap displays an error message and the pipeline execution is terminated when it encounters an already existing file.

Archive messages after reading

Default ValueDeselected
Example: Selected

None

Select this checkbox to move or archive the read messages. If you do not select this checkbox, the read messages are not moved or archived.

Target folder

Value: None
Example: Archived

String/Suggestion

Archive messages after reading

Specify the target location for the archived emails. You need to configure this property only if you select the Archive messages after reading field. This is a suggestible field and the suggestions are based on the folders available in the email account.  

Info

Ensure that you specify the folder name as it appears on the email client, because folder names might be case-sensitive for some email providers, such as Yahoo. Otherwise, the Snap displays Error retrieving folder for given source or destination error.

Snap Execution

Default ValueValidate & Execute
Example: Execute only

Dropdown list

N/A

Select one of the three modes in which the Snap executes. Available options are:

  • Validate & Execute: Performs limited execution of the Snap, and generates a data preview during Pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during Pipeline runtime.

  • Execute only: Performs full execution of the Snap during Pipeline execution without generating preview data.

  • Disabled: Disables the Snap and all Snaps that are downstream from it.

...

The emails read by the Snap can be archived/moved to a specified target location using this Snap. In this example, the emails are moved to the Spam folder. The pipeline is as shown in the screenshot below:

...

The Email Reader Snap is configured as shown in the screenshot below:

...

The Archive messages after reading property is selected, and the target folder is specified as the Spam folder.

...

The

...

email page shows the Inbox of the email account with an email

...

, which will be archived and moved to the Spam folder when the Snap is executed.

...

Below is a preview of the output from the Snap, it shows the body of the email along with other email attributes:

...

When refreshed,

...

the Inbox

...

is updated and the email is moved to the Spam folder:

...

Delete Emails Using the Archive Feature

The emails read by the Snap can be archived/moved to a specified target location using this Snap. In this example, the emails are moved to the Trash folder. The pipeline is as shown in the screenshot below:

...

The Email Reader Snap is configured as shown in the screenshot below:

...

The Archive messages after reading property is selected and the target folder is specified as the Trash folder.

...

The email page displays the Inbox of the email account with an email. This email will be archived and moved to the Trash folder when the Snap is executed.

...

Below is a preview of the output from the Snap, it shows the body of the email along with other email attributes:

...

When refreshed, it can be seen that the Inbox

...

is updated and the email is moved to the Trash folder

...

.

...

Read Inline Images

The pipeline in this example, Reading_Inline_Attachment_Images.slp, demonstrates the image reading functionality of the File Reader Snap. An email containing an inline image and an image as an attachment is passed to the Email Reader Snap.

...

We have an email in a Gmail account inbox that contains both an inline image and an image as an attachment:

The pipeline is designed Configure the Email Reader Snap as shown below:

Image Removed

In the Snap Settings, the Mail folder is set as INBOX and the Attachment folder is defined as Test Folder/Test Attachment Folder.

The output preview of the Snap displays the details of the image files in the email, both inline and attachments:

...

Downloads

Info
  1. Download and import the Pipeline into SnapLogic.

  2. Configure Snap accounts as applicable.

  3. Provide Pipeline parameters as applicable.

...