Email Connector

Prev Next

Functionality Overview

Connected service of the type "Email" allows to sync the incoming content of the email account with module items in Encodify.

As the majority of the connected services in Encodify, configuration of the integration consists of:

  1.  Creating a module with fields in Encodify where the incoming email messages will be synced to

  2.  Creating and configuring of connected account and connected service

  3.  Creating action

Configuration

Module Configuration


After creating a module for email synchronization, the following fields can be configured for synchronizing properties of the incoming email messages. Created fields will be mapped in connected service.

Field

Field type

Message ID

Text

Sender

Text

CC Contacts

Text

Subject

Text

Body

Text / Text box

Attachment

Multiple file field (note, that single file fields are currently not supported for email integration)

Connected Service Configuration


Enable Feature Flag

For the connected service of the type "Email" to be available in Site Configuration > Connections > Connected Services, feature flag needs to be enabled in webapp.yaml

encode:
 webapp:
   connections:
     list: 
       - type: EMAIL
         enabled-sites: '*'

Create and Configure Connected Service

Go to Site Configuration > Connections > Connected Services and click "Add Service" next to the "Email" connected service type.

Screenshot_2021-05-10_at_14.59.49.png

Step 1

First step of the Email connected service configuration is configuration of the connected account. In case email connected service and account has been configured before, it will be available for selection in "Account" drop down.

Leave default selection "Create New" in the "Account" selectbox to create new account and fill in the following required fields:

Screenshot_2021-05-10_at_15.05.46.png

Service Name

Descriptive name of the connected service. The name will be displayed in configuration of the "Sync with Connected Service" action.

Account Name

Descriptive name of the connected account. The name will be displayed in the list connected accounts on the Connected Accounts tab.

Email Type

Currently the following 4 types are supported:

  • POP3

  • POP3S

  • IMAP*

  • IMAPS

POP3S and IMAPS used to support secure protocol for synchronization. When selecting POP3 or IMAP type, note the difference in the way messages are synced.

* there may be limitations related to non-secure IMAP protocol. Even though we list this protocol as supported, it has not been tested due to internal technical limitations.

HOST

Email server host

PORT

IMAP/POP3 port

User

Email account email address

Password

Password for the email account

Step 2

On step 2 it is necessary to select a module to be used for syncing messages to and map the Message Id field.

All other options are not required but also useful. Please refer to the table below for more information.

e738c0ddf8.jpg

Module*

A module to be used for syncing messages to

Message Id*

Unique identifier for each synced message 

Extract Text as HTML

Option to be respected in parsing mail body.

Disabled by default

  • if "Extract Text as HTML" option and "Rich Text Editor"  for mapped "Body" field are enabled - html version of email will be taken

  • if "Extract Text as HTML" option is disabled, plain text version of email will be used

Enable Comment Replies

Option that defines whether comments and replies will be a part of synchronization.

Disabled by default

  • if enabled - Each added item or comment generates an email to the original sender;
    Original sender can create new comment via mailbox by Replying to the message(s) received against the item

  • if disabled - Only standard item creation is supported

Trim Signature in Comments

Option that defines if signature will be visible in comments to be created via email.

Disabled by default

Item Reply Email Template

Template to be used in the messages to be sent on Item(s) Creation

*Required only when Enable Comment Replies is enabled

Comment Reply Email Template

Template to be used in the messages to be sent on Comment(s) Creation

*Required only when Enable Comment Replies is enabled

Step 3

On step 3, map the fields from the selected module to the email attributes.

Please, note the following while doing mapping:

  • there are no required fields, but at least 1 field must be mapped, otherwise, validation will be triggerd preventing from saving a connected service

  • "Attachment" attribute should be mapped to the multiple file field type, as single file fields are currently not supported for syncing attachments.

Mapped_fields.png

After completing mapping and clicking "Save", connected account will be validated and connected service created.

After creation, corresponding connected account will appear in the list of existing connected accounts and all standard CRUD(Create, Read, Update, Delete) operations for the connected service will be available.

Action Configuration


Final step in configuration of Email service integration is creation of actions. To create an action, follow the below described steps:

  1. Go to the configuration of the module mapped in Email connected service, click "Actions" menu.

  2. Click "Create Action" on the Actions toolbar.

  3. In the new action configuration window, enter name for the action.

  4. Select "Scheduled" in the "Event" selectbox.

  5. Select "Sync with Connected Service" in the "Action" selectbox.

  6. Select configued email connected service  in the "Connected Service" select box.

  7. In the "Type of Schedule" section, configure interval for synchronization.

  8. Save the action.

Screenshot_2021-05-10_at_15.46.44.png

Synchronization

With the interval specified in action properties, the inbox will be scanned for the incoming messages and corresponding items or comments (if enabled in Proofing settings and Email Connector settings) will be created in the mapped module.

MessageID field stores unique identifier for each synced message to prevent duplicate synchronization. This means, that when configuring the connected service and mapping modules, the "1 module = 1 account" rule should be followed. 

Message sync depending on selected type

  • POP3/POP3S - all messages in inbox will be syncronized with items and "delete" flag will be sent after syncing with Encodify.

Note!

Some mail services allows to specify starting from which point of time email messages should be synced and how should be treatd after having been synced.  

Example of GMAIL POP3 settings:

Screenshot_2021-05-10_at_16.28.25.png

  • IMAP - only unread messages will be synced and "Seen" flag will be sent after synchronization.

OAuth 2.0 Mechanism for Gmail and Outlook IMAP


Available in version 14.0.0

Google has announced via Less secure apps & your Google Account - Google Account Help that starting May 30, 2022, ​​they will no longer support third-party apps or devices which ask you to sign into your Google Account using only your username and password. Starting from version 14.0.0, Encodify will follow the recommended way to access mail from 3rd party providers OAuth 2.0 Mechanism  |  Gmail  |  Google Developers .

In order to configure email connected service using OAuth 2.0 mechanism, there are few additional steps that are required to generate OAuth2 Client ID and OAuth2 Client Secret keys in Developer Console. 

Below are the steps to generate keys in both Google Developer Console (Gmail) and in Azure Developer Console (Outlook).

Note: Follow Option 1 for Gmail and Option 2 for Outlook configuration.

Option 1: Gmail Configuration in Google Developer Console

Step 1

Open Google Developer Console and login with an existing Gmail account that will be used for the connected service configuration later on.

Step 2

Create a new or open an existing project from 'My Projects' dropdown:

Google_project_1.jpg

Step 3

Navigate to Menu > Open API's and Services > Credentials

Google_Cloud_Credentials.jpg

Step 4

Click '+CREATE CREDENTIALS' and select 'OAuth client ID'

Credentials_Google.jpg

Step 5

  1. Select Application type: Web Application

  2. Change the Name for the app (optional)

  3. Click 'CREATE' button

mceclip0.png

Step 6

The Client ID and Client Secret has now been generated and can be downloaded to JSON format for later use.

Next step is to configure the Web App Connected Service using OAuth 2.0 mechanism. ( Skip below configuration for Outlook in case of configuring connected service for Gmail ).

Credentials_google_keys.jpg

Option 2: Outlook Configuration in Azure Developer Console

Step 1

Open Azure Developer Console and login with an existing Outlook account that will be used for the connected service configuration later on.

( In case of configuring Gmail, follow the steps in Option 1 above )

Azure_1.jpg

Step 2

  1. Name the App

  2. Selected 2nd Supported Account Type: "Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)"

  3. Click 'Register'

Azure_2.jpg

Step 3

Click Client Credentials > 'Add a certificate or secret' From the App page.

Azure_3.jpg

Step 4

Click '+ New client secret' from Certificates & Secrets page.

Azure_4.jpg

Step 5

From the pop-up window:

  1. Add 'description' ( e.g. 'Client Secret')

  2. Click 'Add' button

Azure_5.jpg

Step 6

The Client Secret has now been generated and should be copied from the Value field ( not Secret ID) for later use.

Note: This value will only be displayed once and will be hidden next time page is loaded. In the case value was not copied, the client secret can be deleted and new one should be created.

Azure_6.jpg

Step 7

The Client ID can be found from the Overview page:

Azure_7.jpg

Next step is to configure the Web App Connected Service using OAuth 2.0 mechanism.

Create and Configure Connected Service using Oauth 2.0 Mechanism

Go to Site Configuration > Connections > Connected Services and click "+ Add Service" next to the "Email" connected service type.

Connected_Services_config_1.jpg

Step 1

First step of the Email connected service configuration using OAuth 2.0,  is configuration of the connected account. In case email connected service and account has been configured before, it will be available for selection in "Account" drop down.

Leave default selection "Create New" in the "Account" selectbox to create new account and fill in the following required fields and click 'Next'.

Connected_Services_config_2.jpg

Note the differences for Gmail and Outlook configuration:

Property Name

Google Gmail

MS Outlook

Email Type

IMAP

IMAP

Auth Type

XOAUTH2

XOAUTH2

User

e.g. user@gmail.com

(account linked with Google Developer console)

e.g. user@outlook.com 

(account linked with Azure Developer console)

Server URL

imap.gmail.com  

imap-mail.outlook.com 

Oauth2 Authorization Url

https://accounts.google.com/o/oauth2/v2/auth

https://login.microsoftonline.com/common/oauth2/v2.0/authorize

Oauth2 Access Token Url

https://oauth2.googleapis.com/token

https://login.microsoftonline.com/common/oauth2/v2.0/token

OAuth2 Client ID

Should be taken from application created in Google Developer Console

(see steps above for Gmail)

Should be taken from application created in Azure Developer Console

(see steps above for Outlook)

OAuth2 Client Secret

Should be taken from application created in Google Developer Console

(see steps above for Gmail)

Should be taken from application created in Azure Developer Console

(see steps above for Outlook)

Oauth2 Scope

https://mail.google.com

https://outlook.office.com/IMAP.AccessAsUser.All, offline_access

Step 2

  1. Copy the 'Callback URL' from the service configuration page

  2. Navigate to Google or Azure Developer Console

  3. Add the 'Callback URL' to the list of Redirect URL's

Connected_Services_config_3a.png

Copy 'Callback URL'

Option 1: In Google Developer Console:

  1. Navigate to API's and services > Credentials > OAuth 2.0 Client IDs > {Name}

  2. Paste the Callback URL to 'Authorized redirect URLs'

  3. Click SAVE

  4. Return back to Encodify Web App > Site Configuration > Connections > Connected Services

Google_redirect_1.jpg

Google_redirect_2.jpg

Option 2: In Azure Developer Console:

1. Navigate to Overview > Add a Redirect URL

2. Click '+ Add Platform'

3. From Web applications select 'Web'

4. Paste Callback URL to Redirect URLs field

5. Click Configure 

6. Return back to Encodify Web App > Site Configuration > Connections > Connected Services

Azure_callback_1.jpg

Azure_callback_2.jpg

Azure_callback_3.jpgAzure_callback_4.jpg

Step 3

  1. Copy the 'Authorize URL' from the service configuration page

  2. Open new tab in the same browser

  3. Paste the authorize URL

  4. Press Enter

  5. Expected Response:

    {"result":"Auth code was successfully processed"}

Connected_Services_config_3b.png

Auth_URL_1.jpg

Callback Authorized:

Auth_URL_3_success.jpg

Troubleshooting:

NOT authorized: 401 Error message:

Solution: Make sure user is logged in to the WebApp in the same browser:

Auth_URL_2_error.jpg

Step 4

Select a module to be used for syncing messages and map the Message Id field.

All other options are not required but also useful. More information in the beginning of this article.

  1. Select 'Module'

  2. Select 'Message id' field

  3. Click NEXT

Config_Next.jpg

Step 5

Map the fields from the selected module to the email attributes.

After completing mapping and clicking "Save", connected account will be validated and connected service created.

After creation, corresponding connected account will appear in the list of existing connected accounts and all standard CRUD(Create, Read, Update, Delete) operations for the connected service will be available.

Connected_Services_config_4.jpg

Step 6

Final step in configuration of Email service integration is creation of actions. For more details, please refer to the beginning of this article. (Actions Configuration ).

Known Behavior

  • (Before version 9.106.0) For security reasons all the mark-up present in email body will be escaped.

  • (Before version 9.106.0) Links to images in email body will not be parsed.

  • During synchronization, all types of applicable validation for item creation (required, unique, field type) will take place. In case validation is triggered, synchronization will fail.

  • Default values configured for fields will not be saved (e.g. Created date, Created by etc). 

  • During saving body text to field - if field is RTE - html will be escaped.

  • Comment creation with big size attachment (>10 MB) will lead to the failed synchronization (email will not be sent).

  • Comment creation with restricted file format (like, exe) in attachments will lead to the failed synchronization (email will not be sent to some providers).

  • All comments will generated an email when Encodify Inbox is configured for the module (agreed on demo 2.11.2022)

  • Pasted media (files added via “Insert Media” option into Reply Email Template fields) cannot be rendered in received email

  • Emoji cannot be shown in comment created from yahoo mail provider

  • Yahoo, Outlook: Table properties, Font and Font Background colors from template are not applied in received message

  • Comment with links send via mail in the end of ${CommentContent}

  • Inline images are not inserted into comments as attachments or links

  •  Behavior for POP3/IMAP is different:

    • POP3 - all messages will be downloaded, after processing messages will be deleted (the only supported Flag for POP3 - DELETED)

    • IMAP - only “Unseen” messages will be downloaded, after processing flag “Seen” will be set for them (search with criteria SEEN=false is used for filtering messages)