Incoming Email via API

Email Configuration – Incoming Alemba API

Create the Email Server Source

  1. Create your new Incoming email server source, see Adding a New Server

  2. Select the “Alemba API” protocol is available to select when creating a new incoming email server:

If you cannot see the Alemba API email protocol, please contact Alemba Support.

“Email Server Id” will contain a value. This value is needed when creating requests to add emails via the API.

  1. The remaining fields are the standard incoming email fields.

Logic App Email Configuration

Part 1: Create the Function and the Function App

During the Logic App Configuration, you will need to link to the ReplaceInlineImages Azure function.

  • This action will pass the attachment name, ref and the HTML version of the description to the ReplaceInlineImages functions and will return the updated HTML version of the description, to include the inline image.

You will need to create a function app and the function itself. Please contact Alemba Support if you require assistance.

You will not be able to see or modify the code within the Azure Portal, so if any modifications are needed, they will need to be done in VS Code and redeployed.

Part 2: Build Logic App

  1. Create a Logic App with the “When a new email arrives (V3)” Office 365 Outlook trigger.

  2. The “Include Attachments” parameters needs to be enabled.

  3. Add an “Initialize variable” action where the variable name is Attachments and the type is array:

  4. Add an “Initialize variable” action where the variable name is BodyHtml and the type is string:

  5. Add a “For each” action which will loop through the Attachments from the trigger and will append the Attachments Content, Attachments Name and Attachments Is Inline values to the attachments array:

  6. Add a “Condition” action within the “for each” action that will check whether the Attachments Is Inline value is equal to true:

  7. Go into the settings of the “for each” action and set the concurrency control limit to 1:

  8. Under the “True” side of the condition, add the following actions:

    • Link to the ReplaceInlineImages Azure function

      • This action will pass the attachment name, ref and the HTML version of the description to the ReplaceInlineImages functions and will return the updated HTML version of the description, to include the inline image. Please refer to Part 1 for more information

  9. Set the BodyHtml variable with the DescriptionHtml

Post to the Alemba API

  1. Outside of the “for each” loop, add a new “Http” action that will post the data to the Alemba API.

You will need to add any necessary authentications. The endpoint url will follow this format: https://{Server Endpoint}/{System Name}/alemba.api/api/v2/email-incoming/

  1. The “EmailServerId" parameter is the “Email Server Id” value from the email server settings in ASM.

Last updated