E-Mail: SMTP and IMAP Integration

Disclaimer

Your use of this download is governed by Stonebranch’s Terms of Use, which are available at https://www.stonebranch.com/integration-hub/Terms-and-Privacy/Terms-of-Use/

Overview

The Universal Task for E-Mails allows sending and retrieve E-Mails and E-Mail attachments. It also provides the functionality to download mail attachments to a mail folder.

This Universal Task is especially useful for Stonebranch SaaS customers, which access Universal Controller in the Stonebranch AWS Cloud and have their Universal Agents deployed in their own data center.

Since the Universal Task is triggered from the Universal Agent, no additional firewall ports need to be opened.

Software Requirements

Software Requirements for Universal Agent

  • Universal Agent for Linux or Windows Version 7.0.0.0 or later is required.

  • Universal Agent needs to be installed with python option (--python yes).

Software Requirements for Universal Controller

  • Universal Controller 7.0.0.0 or later is required.

Software Requirements for the Application to be Scheduled

The E-Mail connection settings for Incoming connections to the IMAP server and outgoing connections to an SMTP server are required.

Key Features

  • Send an E-Mail with or without attachments.

  • Use Universal Controller Variables.

  • Retrieve an E-Mail based on filter criteria like From, To, sender, subject, body content …

  • Move an E-Mail to a Mail folder after downloading it to a configured folder.

  • Delete an E-Mail after downloading it to a configured folder.

Import the E-Mail Universal Template

To use this downloadable Universal Template, you first must perform the following steps:

  1. This Universal Task requires the Resolvable Credentials feature. Check that the Resolvable Credentials Permitted system property has been set to true.
  2. Download the provided ZIP file.
  3. In the Universal Controller UI, select Configuration > Universal Templates to display the current list of Universal Templates.
  4. Click Import template.
  5. Select the template ZIP file and import..

When the template has been imported successfully, the Universal Template will appear on the list. Refresh your Navigation Tree to see these tasks in the Automation Center Menu.

Configure E-Mail Universal Tasks

For Universal Task E-Mail, create a new task and select one of the E-Mail Operations, Send Email or Get EMail. Then enter the task-specific Details that were created in the Universal Template.

E-Mail Operation Send Email (SMTP)

Field Descriptions for the E-Mail Task

Fill out the Universal Task for E-Mail for the E-Mail Operation Send Email (SMTP).

FieldDescription

Agent

Linux or Windows Universal Agent to trigger the E-Mail Task.

Agent Cluster

Optional Agent Cluster for load balancing.

E-Mail operations

The following operations can be selected:

[Send Email (SMTP) | Get Email (IMAP)]

Server

SMTP server for outgoing connections.

For example, smtp.web.de

E-Mail credentials

Credentials for the SMTP server for outgoing connections.

Port

SMTP server Port.

For example, SMTP Port = 587

Enable STARTTLS

Chose if your SMTP server is using STARTTLS.

To

To E-Mail Address.

Cc

Carbon Copy E-Mail Address.

Bc

Blind Copy E-Mail Address.

Subject

E-Mail Subject.

Body

E-Mail Body.

Attachment(s)

Path to one or multiple E-Mail attachments.

Multiple attachments are separated via a comma.

For example, C:\demo\out\sap-job.log, C:\demo\out\sap-job2.log

Loglevel

Universal Task logging settings:

[DEBUG | INFO| WARNING | ERROR | CRITICAL]

Example for the E-Mail Operation Send Email

The following example sends the E-Mail attachment sap-job.log from the local directory c:\demo\out\ to john.doe@web.de.

E-Mail Operation Get Email (IMAP)

Field Descriptions for the E-Mail Task

Fill out the Universal Task for E-Mail for the E-Mail Operation Get Email (IMAP).


FieldDescription

Agent

Linux or Windows Universal Agent to trigger the E-Mail Task

Agent Cluster

Optional Agent Cluster for load balancing

E-Mail operations

The following operations can be selected:

[Send Email (SMTP) | Get Email (IMAP)]

Server

IMAP server for incoming connections

For example, imap.web.de

E-Mail credentials

Credentials for the IMAP server for incoming connections

Port

IMAP server Port

For example, IMAP Port = 993

Email Folder

E-Mail Folder to retrieve the E-Mails

For example, inbox

To

Filter: To E-Mail Address

Only E-Mails from the specified E-Mail Address are downloaded

Cc

Filter: Carbon Copy E-Mail Address

Only E-Mails from the specified E-Mail Address in Cc are downloaded

Bc

Filter: Blind Copy E-Mail Address

Only E-Mails from the specified E-Mail Address in Bc are downloaded

Subject

Filter: E-Mail Subject

Only E-Mails that contain the content mentioned in the Subject field are downloaded.

For example, Subject = “Finance-Reports” mean that only E-Mails, which contain in the Subject the word “Finance-Report” are downloaded.

Body

Filter: E-Mail Body

Only E-Mails that contain the content mentioned in the Body field are downloaded.

Message Directory

E-Mail download directory

For example,

c:\demo\inbox\ means that E-Mails are downloaded to the local directory, c:\demo\inbox\.

The E-Mail download format is:

From(<From E-Mail Address>_Date(<YYYY-MM-DDTHH:MM:SS>_Subject(<Subject>)_ID(<random ID>).eml

For example,

From(nils.buer@stonebranch.com)_Date(2021-09-17T162217)_Subject(Finance-Reports)_ID(TsliUXZH).eml

Download File Types(s)

Specify the file type to download. Multiple file types can be listed using a comma as separator.

For example, pdf,txt,docx

Post Action

[Move, None, Delete]

Post action after the E-Mail was downloaded to the folder configured in the field: Message Directory.

  • Move

Move the E-Mail to the folder configured in the field: Move to Folder

  • None

No further action

  • Delete

Delete the E-Mail form the Message Directory configured in the field Message Directory.

Move to Folder

Folder, where the E-Mail is move to after a downloading the E-Mail.

This Field is only available when Post Action:

“Move” has been selected.

For example, Move to Folder read, means that the E-Mail is move to the Mail Folder read after the E-Mail was downloaded to the folder configured in the field: Message Directory.

Loglevel

Universal Task logging settings

[DEBUG | INFO| WARNING | ERROR | CRITICAL]

Example for the E-Mail Operation Get Email (IMAP)

The following example downloads all E-Mail from john.doe@web.de containing in the Subject the word “Finance-Reports” and in the Body the word “Report-2021” to the local directory c:\demo\inbox\.

All E-Mail attachments are downloaded to the directory c:\demo\inbox\attachments. After successful download, the E-Mail is moved to the Mail folder read.

Example of the Downloaded E-Mail:

From(nils.buer@stonebranch.com)_Date(2021-09-17T162217)_Subject(Finance-Reports)_ID(TsliUXZH).eml