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

  • v2.1.1 Release Notes
    • Replace deprecated contentservice and document APIs
  • The changes were relatively straightforward:

    1. Update your build to use the 25.2 sdk
    2. Update version of jakarta to 2.1.x
    3. Replace references to MailSSLSocketFactory with SSLSocketFactory, e.g. 
      MailSSLSocketFactory sf = new MailSSLSocketFactory();
      sf.setTrustAllHosts(true);
      
      is replaced by
      
      SSLSocketFactory sf = (SSLSocketFactory) SSLSocketFactory.getDefault();
  • Hi Mike,

    We have a custom send email plugin that is having the same MailcapRegistryProvider issue with 25.2.  Would you mind sharing the code change you made so that we can apply the same change?

    Jay

  • I’ve tested the new version — it’s working as expected.
    Thanks a lot,   and  

  • Please try out the new version and let us know if it performs as expected.

  • v2.0.4 Release Notes
    • Resolved Jakarta library dependency issue with Appian version 25.2.