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
  • 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.

  • 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()

  •  

    yes, thats correct. This is one key. similar way, you can add multiple keys and values as given in plugin support document.

    For example (change the values as you required)

    java  mail keys

    {
    "mail.<protocol>.connectiontimeout",
    "mail.<protocol>.timeout",
    "mail.<imap/imaps>.fetchsize",
    "mail.<imap/imaps>.auth.plain.disable",
    "mail.<imap/imaps>.auth.ntlm.disable",
    "mail.<imap/imaps>.auth.gssapi.disable"
    }

    java mail values

    { 10000, 10000, 512000, true, true, true }

  • Hi   ,
    I want to know the values of two parameter 
    1.Java Mail Keys
    2.Java Mail Values

    "mail.imaps.connectiontimeout " is this correct?

  • Outside of the cert being bad or just the wrong one, or your connection not supporting TLS 1.2, I can't think of anything else. You can add debugging to log4j on this package to see what the connection properties are.

  • Hi   Yes, these self signed certificates are added under trusted certificates in admin console. but, still receiving this error. Attached the error for reference. Any thoughts?

    PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

  • You will need to add the cert to the trust store in the admin console.

  • Hi  Does this plugin support self signed certificates? We have some issues after changing  server certificates to self signed certificates

  • Relevant logs for reference

    2025-09-24 15:10:57,503 [Thread-30] WARN com.appiancorp.process.workpoller.WorkPollerIntervalLogger - Work Item 963 has been executing for 14 minutes and 47 seconds. Process Id: 268681613. Process Model Id: 1878. Thread: Appian Work Item - 11391 - WorkID 963 - execution01 - process 268681613 - model 1878 : UnattendedJavaActivityRequest. Stack trace:
    java.base@17.0.16/java.net.SocketInputStream.socketRead0(Native Method)
    java.base@17.0.16/java.net.SocketInputStream.socketRead(SocketInputStream.java:112)
    java.base@17.0.16/java.net.SocketInputStream.read(SocketInputStream.java:165)
    java.base@17.0.16/java.net.SocketInputStream.read(SocketInputStream.java:137)
    java.base@17.0.16/java.net.Socket$SocketInputStream.read(Socket.java:966)
    java.base@17.0.16/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:484)
    java.base@17.0.16/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:478)
    java.base@17.0.16/sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:70)
    java.base@17.0.16/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1465)
    java.base@17.0.16/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:1069)
    org.eclipse.angus.mail.util.TraceInputStream.read(TraceInputStream.java:107)
    java.base@17.0.16/java.io.BufferedInputStream.fill(BufferedInputStream.java:244)
    java.base@17.0.16/java.io.BufferedInputStream.read(BufferedInputStream.java:263)
    org.eclipse.angus.mail.iap.ResponseInputStream.readResponse(ResponseInputStream.java:80)
    org.eclipse.angus.mail.iap.Response.<init>(Response.java:113)
    org.eclipse.angus.mail.imap.protocol.IMAPResponse.<init>(IMAPResponse.java:40)
    org.eclipse.angus.mail.imap.protocol.IMAPProtocol.readResponse(IMAPProtocol.java:413)
    org.eclipse.angus.mail.iap.Protocol.command(Protocol.java:378)
    org.eclipse.angus.mail.imap.protocol.IMAPProtocol.fetch(IMAPProtocol.java:2158)
    org.eclipse.angus.mail.imap.protocol.IMAPProtocol.fetch(IMAPProtocol.java:2150)
    org.eclipse.angus.mail.imap.protocol.IMAPProtocol.fetchSectionBody(IMAPProtocol.java:1862)
    org.eclipse.angus.mail.imap.protocol.IMAPProtocol.fetchBody(IMAPProtocol.java:1845)
    org.eclipse.angus.mail.imap.protocol.IMAPProtocol.fetchBody(IMAPProtocol.java:1834)
    org.eclipse.angus.mail.imap.IMAPInputStream.fill(IMAPInputStream.java:135)
    org.eclipse.angus.mail.imap.IMAPInputStream.read(IMAPInputStream.java:244)
    org.eclipse.angus.mail.imap.IMAPInputStream.read(IMAPInputStream.java:271)
    org.eclipse.angus.mail.util.BASE64DecoderStream.getByte(BASE64DecoderStream.java:345)
    org.eclipse.angus.mail.util.BASE64DecoderStream.decode(BASE64DecoderStream.java:236)
    org.eclipse.angus.mail.util.BASE64DecoderStream.read(BASE64DecoderStream.java:128)
    java.base@17.0.16/java.io.FilterInputStream.read(FilterInputStream.java:106)
    org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1483)
    org.apache.commons.io.IOUtils.copy(IOUtils.java:1107)
    org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1456)
    org.apache.commons.io.IOUtils.copy(IOUtils.java:1085)
    com.appiancs.mail.MailPollerSmartService$MessageHandler$1.accept(MailPollerSmartService.java:248)
    com.appiancs.mail.MessageUtil.processAttachments(MessageUtil.java:282)
    com.appiancs.mail.MailPollerSmartService$MessageHandler.process(MailPollerSmartService.java:239)
    com.appiancs.mail.MailPoller.poll(MailPoller.java:115)
    com.appiancs.mail.MailPollerSmartService.run(MailPollerSmartService.java:148)
    com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.lambda$call$0(DefaultActivityExecutor.java:129)
    com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1$$Lambda$5913/0x00000007c39aebf8.run(Unknown Source)
    com.appiancorp.plugins.PluginUsageLogger.runWithPluginInformation(PluginUsageLogger.java:54)
    com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:129)
    com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:123)
    com.appiancorp.common.ContextClassLoaderSwitcher.runInContext(ContextClassLoaderSwitcher.java:30)
    com.appiancorp.process.runtime.framework.DefaultActivityExecutor.execute(DefaultActivityExecutor.java:123)
    com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute(UnattendedJavaActivityRequest.java:110)
    com.appiancorp.process.engine.UnattendedJavaActivityRequest$$Lambda$5191/0x00000007c34862f0.apply(Unknown Source)
    com.appiancorp.process.engine.UnattendedJavaActivityRequestResponseCreator.getJavaActivityResultResponse(UnattendedJavaActivityRequestResponseCreator.java:23)
    com.appiancorp.process.engine.UnattendedJavaActivityRequest.getJavaActivityResultResponse(UnattendedJavaActivityRequest.java:89)
    com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute0(UnattendedJavaActivityRequest.java:72)
    com.appiancorp.process.engine.ProcessContinuationRequest$$Lambda$5186/0x00000007c3484ac0.call(Unknown Source)
    com.appiancorp.common.persistence.data.AppianDataUserContextProvider.executeWithConsistentDataReads(AppianDataUserContextProvider.java:143)
    com.appiancorp.process.engine.ProcessContinuationRequest.executeOuter(ProcessContinuationRequest.java:68)
    com.appiancorp.process.engine.ActivityRequest.executeOuter(ActivityRequest.java:41)
    com.appiancorp.process.engine.ContinuationRequest.execute(ContinuationRequest.java:136)
    com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute(UnattendedJavaActivityRequest.java:125)
    com.appiancorp.process.workpoller.UnattendedRequestHandlerBean.onMessage(UnattendedRequestHandlerBean.java:36)
    com.appiancorp.process.workpoller.WorkItem.run(WorkItem.java:110)
    org.springframework.jca.work.SimpleTaskWorkManager$DelegatingWorkAdapter.run(SimpleTaskWorkManager.java:241)
    java.base@17.0.16/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    java.base@17.0.16/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    java.base@17.0.16/java.lang.Thread.run(Thread.java:840)

  • We are on 25.2 and this plugin is working fine till last week. but we are receiving the below message adhoc and even though we configure the time limit for 3 minutes the log says its polling and reading the data for 30-46 minutes in the background. No changes to code. Any thoughts to troubleshoot

    "The amount of time allocated for the completion of an unattended activity was insufficient to allow the activity to complete"