Display Email HTML Body

Certified Lead Developer

We are currently performing extensive email triage on a project and have a need to display the HTML body of the incoming email. The reason plain text is not feasible is that the HTML email body contains information in a tabular format. This information is critical to the user as it contains very specific and relevant information.

Currently, the Document Viewer component does not support the display of HTML documents. The Web Content component is able to display HTML but does not allow this if the source is being served up inline by Appian via a Web API, i.e. "Source may not be an internal Appian source."

We are able to generate a PDF from HTML using the Dynamic Document Generator plugin found on the AppMarket. The translation from HTML to PDF is not perfect however due to "creative" formatting from time to time.

Note, I would love it if we couple display HTML documents using either the Document Viewer or Web Content components. I do understand however that there may be possible security and privacy issues if there were hyperlinks and/or downloadable content or javascript embedded within the HTML...hence the limitation.

Has anyone else had this or a similar requirement and how did you solve it ( other than using the above mentioned methods )?

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    I'm not sure how "officially supported" this method would be, but I noticed several weeks ago that a Web API component can serve up a page that displays arbitrary input HTML as its body, and is pretty easy to do using OOB functionality.  This does, of course, carry all the downfalls of displaying HTML directly, which you already mentioned.

    I think the "official" supported method would be to use the method you've already tried, i.e. converting to PDF first.

  • Hi Mike,

    I'm having the same problem here. I was able to export the email body to PDF but it just doesn't look right within the Document Viewer component. Can you please explain how the Web API would work with the input HTML? I've tried multiple things and the Web Content component always returns "Source may not be an internal Appian source"

  • Linking to a Web API as source for Web Content does not work anymore. We had a solution to show a fancy JavaScript Calendar. We reworked it to a Component Plugin. In the end, turning the email into a PDF seems be the most secure option. But that might require you to use other PDF generation options than the built in one.

  • 0
    Certified Lead Developer
    in reply to FernandoCespedes

    I wasn't referring to the Web Content field, actually.  What you'd do is make a safeLink pointing to the URL of the Web API, and have the API serve back HTML.  This can be used to open a new tab and show necessary HTML within it.  Obviously, this is quite a bit of a workaround, but could be useful in certain cases.

  • Hi, what doesn't look right about the document in the viewer component? I will share my template tomorrow if it helps as it is working really well for us at the moment.

  • Thank you for your response. That is actually a good idea but I already generated a ."eml" document with a link to open the email in a separate window. What I wanted to do was to show a preview of the emails on the screen so users don't need to open multiple windows (similar to an email app or MS Outlook). I'm working on a Contact Center application with email polling, and we generate automated requests based on a lot of emails the users receive daily.

  • 0
    Certified Lead Developer
    in reply to FernandoCespedes

    I've been thinking about this use case for years - the closest I've come is one of the solutions discussed here already - either converting to PDF and showing in the document preview window (which fails for my customer onsite due to the weird domain it uses not being whitelisted by their security organization), or showing the HTML manually in a new tab via a link that potentially exposes the document ID.  Both are far from perfect.

  • Hi Dai,

    We can view the PDF on the screen but the formatting is just not right. Since the emails we receive may contain signatures at the end, headers, or bullet-pointed paragraphs, the width of the document can be very large causing the PDF to show extremely small on the screen. Yes, users can zoom in and scroll to the right but it's time consuming and when you are reviewing a lot of emails during the day this is just not practical. We could also get rid of all the formatting and show the email as simple text but in some cases users need to extract numbers from large emails and without proper formatting this can take some time. I was thinking about inserting <br> tags in the HTML body but since the MS Outlook templates can include multiple levels of tags for their particular formatting, it could be a very challenging task.

  • Hi Frenando,

    Was wondering what solutions you landed on to display the email?  Im working on project with similar challenges.

    Also wondering in your use case, if you had need to correlate multiple emails together in a threaded fashion and if so could you provide any advice on how you accomplished that,



Reply Children