Mail Server to Database

Overview

This version is for Appian 25.1 and above. Cloud customers on a lower version of Appian that want to install this plugin should open a support case. Self-managed customers can download the latest JAR for Appian 25.1 and later from the AppMarket.

Enhancement to the plug-in to enable the selection of whether or not to include the email attachments as part of the EML document. Previously, the plug-in would create an EML document with the attachments stripped out. Our client needs to preserve the original e-mail as it was sent (for auditing purposes), so the EML must include the attachments as part of it. This update extends the functionality to allow the user to select whether they want an EML with the attachments removed (original functionality), an EML with attachments included, or both (2 EMLS of original email - one without the attachments included and one with the attachments included). Any e-mail attachments will continue to be saved separately.

Key Features & Functionality

Takes all unread email from a mailbox and adds entries directly to a database table.The original email is saved as an EML based on three attachment type options

  1. EML with attachments removed
  2. EML with attachments included
  3. Both (2 EMLs of original email) - EML with attachments removed and EML with attachments included

Each email attachment is saved as its own document. The database tables store the Appian document ids, email recipients, subject and body (text and HTML)

Anonymous
Parents
  • Hi   

    We’ve been using this plugin for a while, and recently noticed some issues while processing emails related to the charset (see error below). The main problem is that when an error occurs, the smart service doesn’t return any error message, and there’s no option to mark the email as unread on failure. This makes it difficult to identify which emails failed to process. Ideally, we’d expect the error details to be included in the error message or have the email marked as unread when a failure occurs. At the very least, if we can capture the error message, we can set up alerts and better understand what’s happening.

    UnattendedJavaActivityRequest] ERROR com.appiancs.mail.MailPoller - Error processing message
    java.lang.NullPointerException: Cannot invoke "jakarta.mail.internet.ParameterList.get(String)" because the return value of "jakarta.mail.internet.ContentType.getParameterList()

  • You can determine the onSuccess and onFailure behavior by setting different flags on the emails. By default, successfully processed messages are deleted, and messages that were not processed are marked as read. Only unread messages are polled, so whatever is left in the mailbox, errored out. I would recommend against setting the errored out messages as UNSEEN since they will continue to poll.

    In terms of error handling, the easy thing to do would be to add stack trace per error (currently seems to be swallowed). More robust error handling is going to be more complicated and a longer term investment.

Comment
  • You can determine the onSuccess and onFailure behavior by setting different flags on the emails. By default, successfully processed messages are deleted, and messages that were not processed are marked as read. Only unread messages are polled, so whatever is left in the mailbox, errored out. I would recommend against setting the errored out messages as UNSEEN since they will continue to poll.

    In terms of error handling, the easy thing to do would be to add stack trace per error (currently seems to be swallowed). More robust error handling is going to be more complicated and a longer term investment.

Children
  • Got it, thanks for flagging this.

  • Hi   Thanks for the suggestion. We’ve noticed that this issue occurs frequently with emails where the content type is "text/plain" and the charset is not specified, causing those emails to fail processing.

    Would it be possible to update the plugin to set a default charset when it is null?

    Code snippet of the error : 

      if (content instanceof String) {
    ContentType contentType = new ContentType(getContentType(orig));

    reply.setText(
    (String) content,
    contentType.getParameterList().get("charset"),
    contentType.getSubType());
    }