MSGraph Email Poller

Overview

Need to poll emails from your Exchange server? This smart service can be used in a poller process and extract the data from the Microsoft Exchange server. Messages are stored in the Appian Document System, as well as the attachments. Meta data is stored in a database table for further processing.

This plug-in provides an alternative to sending emails to an Appian process model when inbound email integration is requested. Instead of the email being forwarded to Appian, this plug-in reads the emails directly from the Exchange mailbox using the MS Graph API as described below:

  • Reads the mailbox using the MS Graph API
  • Convert the email to an EML file stored as an Appian document; Item attachments (calendar invites, messages) are kept in the eml file, File attachments removed from it and stored separately in the document management system.
  • Store all email file attachments as separate Appian documents
  • Store all email metadata (subject, author, recipients, etc...) into a set of tables in the database

Key Features & Functionality

All information how to deploy, configure and use the smart service is in the 'MS Graph Mail Poller.pdf' document in the downloaded zip. Extract the files in the ZIP and follow the instructions in the document.

Anonymous
  • v4.1.1 Release Notes
    • Fixed email aliases. Aliases used by the sender in To and Cc fields are correctly recorded in the database To and Cc fields rather than the main/parent email address.
    • [This behaviour regressed at v4.0.0 with the move to Jakarta mail]

  • We are upgrading to Appian 23.2.  MSGraph Mail Poller is not working in the upgraded environments.  Is MSGraph Mail Poller compatible with 23.2?  In system logs I see "Unexpected error polling for mail com.microsoft.graph.core.ClientException: Error executing the request". 

    Is there any issue you've heard of / seen with Appian 23.2?  Is this supported?  (I see Compatible Version: 22.3 in Information).  This plug in worked with 23.1 no problems.

  • We have observed the emails moving to Delete folder post polling and is there a possible way to route the emails for any folder user have provided?

  • Hi, is there a possibility to limit types of attachments the plugin can work with? it seems that the mail poller ignores file upload settings from the admin console

    BR, Aleksandrs Sirotinskis

  • Did you resolve it? I'm facing same issue. I want to move the emails to seperate folder.

  • Hello 

    After many problems I have managed to make the plugin work. I put the key points to make it work.
    1. The test connection button in the admin console always shows a connection error but it does not mean that the plugin does not work, you have to test it from a process model.
    2. The tenant id is not put in the format that comes in the documentation, only the tenant id must be put.
    3.The Azure administrator must give the application id read and write permissions on the mailbox to be read.
    4. The database scripts that come in the zip are not correct, they are missing fields, the script must be like that.
    5. the secret id must always be the secret value.

    6. If you want to know more details about the errors, you should go to the appian logs and search in stdout.log


    SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
    START TRANSACTION;
    SET time_zone = "+00:00";



    CREATE TABLE `APP_MAIL_POLLER` (
      `APP_MAIL_POLLER_ID` int(11) NOT NULL,
      `FROM_EMAIL` text DEFAULT NULL,
      `FROM_NAME` text DEFAULT NULL,
      `SUBJECT` varchar(700) DEFAULT NULL,
      `TO_EMAILS` text DEFAULT NULL,
      `TO_NAMES` text DEFAULT NULL,
      `CC_EMAILS` text DEFAULT NULL,
      `CC_NAMES` text DEFAULT NULL,
      `BCC_EMAILS` text DEFAULT NULL,
      `BCC_NAMES` text DEFAULT NULL,
      `IN_REPLY_TO` text DEFAULT NULL,
      `MESSAGE_ID` varchar(500) DEFAULT NULL,
      `IMPORTANCE` varchar(11) DEFAULT NULL,
      `STATUS` varchar(255) DEFAULT NULL,
      `BODY_TEXT` longtext DEFAULT NULL,
      `BODY_HTML` longtext DEFAULT NULL,
      `DOC_ID` int(11) DEFAULT NULL,
      `RECEIVED_DATE` datetime DEFAULT NULL,
      `SYS_DATE` datetime DEFAULT current_timestamp(),
      `DOC_ID_NO_ATT` int(11) NOT NULL,
      `BODY_SWAPPED_IMAGES` longtext NOT NULL,
      `MESSAGE_GRAPH_ID` varchar(4000) NOT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ROW_FORMAT=DYNAMIC;

    ALTER TABLE `APP_MAIL_POLLER`
      ADD PRIMARY KEY (`APP_MAIL_POLLER_ID`),
      ADD UNIQUE KEY `UNIQUE_MESSAGE_ID` (`MESSAGE_ID`);

    ALTER TABLE `APP_MAIL_POLLER`
      MODIFY `APP_MAIL_POLLER_ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
    COMMIT;


    CREATE TABLE `APP_MAIL_POLLER_DOC` (
      `APP_MAIL_POLLER_DOC_ID` int(11) NOT NULL,
      `APP_MAIL_POLLER_ID` int(11) NOT NULL,
      `ELT` int(11) DEFAULT NULL,
      `DOC_IDX` int(11) NOT NULL,
      `SYS_DATE` datetime DEFAULT current_timestamp(),
      `IS_INLINE` tinyint(4) NOT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

     
    ALTER TABLE `APP_MAIL_POLLER_DOC`
      ADD PRIMARY KEY (`APP_MAIL_POLLER_DOC_ID`),
      ADD UNIQUE KEY `APP_MAIL_POLLER_ID` (`APP_MAIL_POLLER_ID`,`DOC_IDX`),
      ADD UNIQUE KEY `UNIQUE_DOC` (`DOC_IDX`,`APP_MAIL_POLLER_ID`);

    ALTER TABLE `APP_MAIL_POLLER_DOC`
      MODIFY `APP_MAIL_POLLER_DOC_ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;


    ALTER TABLE `APP_MAIL_POLLER_DOC`
      ADD CONSTRAINT `FK_APP_MAIL_POLLER_ID` FOREIGN KEY (`APP_MAIL_POLLER_ID`) REFERENCES `APP_MAIL_POLLER` (`APP_MAIL_POLLER_ID`);
    COMMIT;


    GOOD LUCK!!!

  • You just have to put the tenant id, nothing else

  • Make sure your application ID has full access to the inbox you try to connect to. Your Azure admin must set the permissions to Type: Application Permission: Mail.ReadWrite. The scope can then be reduced to the mailboxes you need to have access to from Appian. The error indicates that you are not allowed to access the deletedItem folder for the mailbox, which is the first check that is made within the plugin to validate access 

  • just the tenant ID; please check the documentation that is included if you download the plugin files from the download link here.

  • What would be the correct format to indicate the tenant?

    the domain name is: Aena, SME S.A.

    and tenant :
    3ea6ba9c-a793-4c3xxxxxxxxxxxxxxxxxx