This blog contains information and steps to create a new App Connect Professional project, GetEmail activity and Email endpoint in App Connect Professional Studio to connect to Microsoft Exchange Online and Gmail to retrieve email.
Create a new App Connect Professional Project
From the File menu, select New -> New Project.
Enter the Project Name, select the Project Directory and click OK.
Create a GetEmail activity and endpoint
With the Orchestration open, in the Activities tab on the right, scroll down to Email, expand Email, drag Get Email and drop over Add Starter Activity.
This creates a new Get Email activity.
In the lower-right, under Checklist, click Pick Endpoint and click on New.
Configure OAuth2.0 properties for Microsoft Exchange Online
In the Create Endpoint panel, enter the below values for connecting to Microsoft Exchange Online:
Under Location, select Get Email from Server.
Host Name: outlook.office365.com
Port: 995
Under Login, select Log into the Server using OAuth2.0.
Grant Type: client_credentials
Client Id: <Application (client) ID obtained from Azure>
Client Secret: <Application's 'client secret' value (application password)>
Refresh Token: <Leave this field blank for Microsoft Exchange Online>
Access Token: <Access token to authenticate to Microsoft Exchange Online>
Scope: https://outlook.office365.com/.default
Auth Server Url: https://login.microsoftonline.com/<Tenant ID>/oauth2/v2.0/token
Username: <Email address of the user mailbox to connect to>
Redirect Url: <Leave this field blank for Microsoft Exchange Online>
Refer to https://learn.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth to register an application for accessing Office 365 mailboxes via POP3 protocol and receive its Application (client) ID, Client secret and Directory (tenant) ID.
Click on Test Connection to verify the connectivity to Exchange Online server using the Access Token.
Upon successful connection, “You’ve successfully connected to the endpoint” will display.
Configure the Activity, Delivery Rules, Retry and Map Outputs as required. Mailheader and body are the available outputs from the Get Email activity.
Run orchestration and retrieve Email
To run the orchestration, open the Orchestration, under Verify tab, click on the Play button icon on the top.
Activity will connect to the endpoint using the Access Token configured in the endpoint panel. If the Access Token is not valid, a new Access Token is generated with the properties configured under the endpoint panel and used to connect to the Exchange Online server.
Configure OAuth2.0 properties for Gmail
In the Project tab on the right, click on the New Orchestration button to create a new orchestration.
With the orchestration open, in the Activities tab on the right, scroll down to Email, expand Email, drag Get Email and drop over Add Starter Activity.
In the lower-right, under Checklist, click Pick Endpoint and click on New.
In the Create Endpoint panel, enter the below values for connecting to Gmail:
Under Location, select Get Email from Server.
Host Name: pop.gmail.com
Port: 995
Under Login, select Log into the Server using OAuth2.0.
Grant Type: refresh_token
Client Id: <Application (client) ID as configured in Google Cloud console>
Client Secret: <Application's 'client secret' value>
Refresh Token: <Refresh token to generate new Access Tokens>
Access Token: <Access token to connect to Gmail>
Scope: https://mail.google.com/
Auth Server Url: https://oauth2.googleapis.com/token
Username: <Email address of the user mailbox to connect to>
Redirect Url: Redirect Url for the web app. Enter a value “urn:ietf:wg:oauth:2.0:oob” for this field for Gmail.
Refer to https://blog.rebex.net/howto-register-gmail-oauth for configuring OAuth2.0 access to Gmail mailbox.
Click on Test Connection to verify the connectivity to Exchange Online server using the Access Token. Upon successful connection, “You’ve successfully connected to the endpoint” will display.
Configure the Activity, Delivery Rules, Retry and Map Outputs as required. Mailheader and body are the available outputs from the Get Email activity.
Run orchestration and retrieve Email
To run the orchestration, open the Orchestration, under Verify tab, click on the Play button icon on the top. Activity will connect to the endpoint using the Access Token configured in the endpoint panel. If the Access Token is not valid, a new Access Token is generated with the properties configured under the endpoint panel and used to connect to Gmail server.
Run the project in App Connect Professional appliance
Click on the Publish Project button in Studio to publish the project to App Connect Professional appliance.
Once the project is published to App Connect Professional appliance, login to WMC and select Run Configuration from the flow menu against the project under Project Configurations.
The below screens show the jobs initiated in the appliance for the Emails retrieved from Microsoft Exchange Online and Gmail mailboxes.
In this blog we have shown how a user can configure GetEmail activity to retrieve email from Microsoft Exchange Online and Gmail servers.