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
Parents
  • We setup the MSGraph Email Poller to point to the Inbox of a shared group folder. Before the Poller process ran, a secure email was received into the Inbox and one of the people in the email group opened the email and sent a response to the sender.

    The response generated an automated system email from the System Administrator into the Inbox with the message: "Your message did not reach some or all of the intended recipients. This message could not be sent. You do not have the permission to send the message on behalf of the specified user."

    When the Email Poller ran every 5 minutes after the system-generated email appeared in the Inbox, it continued to fail because it was unsuccessful when trying to process this system-generated message. The system-generated message was not moved to the Exception Folder identified in the MS Graph Mail Poller smart service. Once the system-generated message was manually removed from the Inbox, there were no more Email Poller errors and other emails in the Inbox were able to be processed.

    Can the MSGraph Email Poller be updated to handle this type of message by sending the system-generated email to the Exception Folder and to not cause an error that keeps other emails from being processed?

  • If your error is occurring when the poller is trying to write the email to the database, then the latest update (v2.3.1) should fix the issue and result in the failing email being moved to the exception folder.

    If the error is occurring before trying to write the email to the database, then this may be a new issue that is missing the proper error handling.

    I suggest you try with the latest version of the poller. You will need to add 1 additional column to your poller table (as v2.3.0 introduced a new message graph id field) - compare your current DB schema with the one packaged with the plugin to verify this.

  • Hi Raymond. 

    Sorry for the delay.  I just uploaded 2.3.2 yesterday and tested.  The new version resolves the erroneous email issue.  The erroneous email now goes to the identified exception folder and good emails are processed as usual and go to the success folder.  Thanks for such a quick response!  Also, sorry for the multiple posts.  I kept getting Appian errors for each post and the page was not updating, so I didn't think the messages were getting posted.

  • Hi Richard,

    I just submitted an update that should better handle this error and move the erroneous email to the exception folder. Please retest after version 2.3.2 has been made available

  • Hello.  We upgraded to version 2.3.1.  We added a system-generated email to the Inbox.  The poller had an error during email processing.  The email did not get moved to the identified exception folder.  

    I was unable to test an encrypted email in non-prod, so we are assuming it is the system-generated email that is causing the issue and not the encrypted email. It looks like encrypted emails are being handled in prod, however, the file that is stored in the Appian folder does not contain a file type.  If you want to reach me directly: richard_hurlbrink@vanguard.com

  • Hello.  We upgraded to version 2.3.1.  We added a system-generated email to the Inbox.  The poller had an error during email processing.  The email did not get moved to the identified exception folder.  From the logs:

    2022-03-02 21:09:59,571 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMailPollerWithAttachmentSmartService - Connecting to MS Graph authentication provider
    2022-03-02 21:09:59,794 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphConnector - init Done, accessToken received
    2022-03-02 21:09:59,795 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMailPollerWithAttachmentSmartService - Starting mail processing
    2022-03-02 21:10:00,295 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMailPoller - Found the Exchange folder for the exceptioned emails: _Poller Failed with ID: AAMkAGQ2YmJhM2NjLTdhNDctNDFjNi1hMGRmLWY1NjBhYmFmMDFmMwAuAAAAAAATIxm6VlIXSbcPStrem26NAQBYG-Lnd_pkRqe5wa-ZbTItAABWI4ioAAA=
    2022-03-02 21:10:00,295 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMailPoller - Found the Exchange folder for the processed emails: _Poller Processed with ID: AAMkAGQ2YmJhM2NjLTdhNDctNDFjNi1hMGRmLWY1NjBhYmFmMDFmMwAuAAAAAAATIxm6VlIXSbcPStrem26NAQBYG-Lnd_pkRqe5wa-ZbTItAABWI4inAAA=
    2022-03-02 21:10:00,398 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMessageHandler - processing:Undeliverable: test1
    2022-03-02 21:10:00,895 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMessageHandler - Email EML file created from mime content: 185041
    2022-03-02 21:10:02,357 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMessageHandler - processed : 1 attachments
    2022-03-02 21:10:02,443 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] ERROR com.appiancs.msgraphmail.MSGraphMessageHandler - Error during email processing

    I was unable to test an encrypted email in non-prod, so we are assuming it is the system-generated
    email that is causing the issue and not the encrypted email.
    It looks like encrypted emails are being handled in prod, however, the file that is stored in the
    Appian folder does not contain a file type.
  • Hello.  We upgraded to the latest version 2.3.1.  We added a system generated undeliverable email to the inbox.  The poller had an error during the email processing.  Appian turned on the debugger for us.  From the log:

    2022-03-02 21:09:59,571 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMailPollerWithAttachmentSmartService - Connecting to MS Graph authentication provider
    2022-03-02 21:09:59,794 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphConnector - init Done, accessToken received
    2022-03-02 21:09:59,795 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMailPollerWithAttachmentSmartService - Starting mail processing
    2022-03-02 21:10:00,295 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMailPoller - Found the Exchange folder for the exceptioned emails: _Poller Failed with ID: AAMkAGQ2YmJhM2NjLTdhNDctNDFjNi1hMGRmLWY1NjBhYmFmMDFmMwAuAAAAAAATIxm6VlIXSbcPStrem26NAQBYG-Lnd_pkRqe5wa-ZbTItAABWI4ioAAA=
    2022-03-02 21:10:00,295 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMailPoller - Found the Exchange folder for the processed emails: _Poller Processed with ID: AAMkAGQ2YmJhM2NjLTdhNDctNDFjNi1hMGRmLWY1NjBhYmFmMDFmMwAuAAAAAAATIxm6VlIXSbcPStrem26NAQBYG-Lnd_pkRqe5wa-ZbTItAABWI4inAAA=
    2022-03-02 21:10:00,398 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMessageHandler - processing:Undeliverable: test1
    2022-03-02 21:10:00,895 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMessageHandler - Email EML file created from mime content: 185041
    2022-03-02 21:10:02,357 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMessageHandler - processed : 1 attachments
    2022-03-02 21:10:02,443 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] ERROR com.appiancs.msgraphmail.MSGraphMessageHandler - Error during email processing

    The email remained in the Inbox and was not moved to the exception folder identified.

    There may be another issue as well, but I can't replicate it in our test environment with a test Outlook account, so I can't say for sure.  We assumed it was the system generated email that was solely causing the issue, but in addition to this, an encrypted email may have been the original culprit.

    Here's what happened: an encrypted email was sent to the Inbox being processed by the poller.  While it was in the inbox, a user tried to respond to the encrypted message, which spawned the system-generated undeliverable email.  The encrypted email is stored in an Appian folder, but does not contain a file type.  When I open it in Notepad, the first line starts as follows: From: "/O=EXCHANGELABS/OU=EXCHANGE ADMINISTRATIVE GROUP.  However, it does look like this email was processed, so may not be an issue.  If you need to contact me directly: richard_hurlbrink@vanguard.com

Comment
  • Hello.  We upgraded to the latest version 2.3.1.  We added a system generated undeliverable email to the inbox.  The poller had an error during the email processing.  Appian turned on the debugger for us.  From the log:

    2022-03-02 21:09:59,571 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMailPollerWithAttachmentSmartService - Connecting to MS Graph authentication provider
    2022-03-02 21:09:59,794 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphConnector - init Done, accessToken received
    2022-03-02 21:09:59,795 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMailPollerWithAttachmentSmartService - Starting mail processing
    2022-03-02 21:10:00,295 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMailPoller - Found the Exchange folder for the exceptioned emails: _Poller Failed with ID: AAMkAGQ2YmJhM2NjLTdhNDctNDFjNi1hMGRmLWY1NjBhYmFmMDFmMwAuAAAAAAATIxm6VlIXSbcPStrem26NAQBYG-Lnd_pkRqe5wa-ZbTItAABWI4ioAAA=
    2022-03-02 21:10:00,295 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMailPoller - Found the Exchange folder for the processed emails: _Poller Processed with ID: AAMkAGQ2YmJhM2NjLTdhNDctNDFjNi1hMGRmLWY1NjBhYmFmMDFmMwAuAAAAAAATIxm6VlIXSbcPStrem26NAQBYG-Lnd_pkRqe5wa-ZbTItAABWI4inAAA=
    2022-03-02 21:10:00,398 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMessageHandler - processing:Undeliverable: test1
    2022-03-02 21:10:00,895 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMessageHandler - Email EML file created from mime content: 185041
    2022-03-02 21:10:02,357 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] DEBUG com.appiancs.msgraphmail.MSGraphMessageHandler - processed : 1 attachments
    2022-03-02 21:10:02,443 [Appian Work Item - 370400 - execution02 : UnattendedJavaActivityRequest] ERROR com.appiancs.msgraphmail.MSGraphMessageHandler - Error during email processing

    The email remained in the Inbox and was not moved to the exception folder identified.

    There may be another issue as well, but I can't replicate it in our test environment with a test Outlook account, so I can't say for sure.  We assumed it was the system generated email that was solely causing the issue, but in addition to this, an encrypted email may have been the original culprit.

    Here's what happened: an encrypted email was sent to the Inbox being processed by the poller.  While it was in the inbox, a user tried to respond to the encrypted message, which spawned the system-generated undeliverable email.  The encrypted email is stored in an Appian folder, but does not contain a file type.  When I open it in Notepad, the first line starts as follows: From: "/O=EXCHANGELABS/OU=EXCHANGE ADMINISTRATIVE GROUP.  However, it does look like this email was processed, so may not be an issue.  If you need to contact me directly: richard_hurlbrink@vanguard.com

Children
  • Hi Raymond. 

    Sorry for the delay.  I just uploaded 2.3.2 yesterday and tested.  The new version resolves the erroneous email issue.  The erroneous email now goes to the identified exception folder and good emails are processed as usual and go to the success folder.  Thanks for such a quick response!  Also, sorry for the multiple posts.  I kept getting Appian errors for each post and the page was not updating, so I didn't think the messages were getting posted.

  • Hi Richard,

    I just submitted an update that should better handle this error and move the erroneous email to the exception folder. Please retest after version 2.3.2 has been made available