Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Incoming email is displayed without any specific format

SA-8630

Summary



User is having Email listener which listens to an Users Inbox and creates interaction. Upon opening the interaction from application, user can view the email content received, in a Rich text Editor. User Mail Box is configured in Lotus Notes Server.

Some of the incoming emails, with content type other than HTML, do not have correct formatting in the content. When displaying the same content in a Rich text Editor, total email content is shown without any specific format. But if we view the same in Lotus notes, the alignment is available.


Error Messages



Not Applicable

Steps to Reproduce



1. Send an email with anattachment or forward an email which is received from a different email server, the content type should be multipart/alternative or if it contains attachment then it should be multipart/mixed.
2. Observe the display of content in a Rich text Editor.


Root Cause



The root cause of this problem is in a third-party product. RTE is unable to recognize various unsupported fonts styles. The incoming email's format is missing only for few content-types like multipart-mixed and multipart-related.


Resolution



The content-type of the header can be tracked but it is difficult to retrieve the content-type of the email body. Scan the whole email body, find the HTML tags and if there are no HTML tags then the body is enclosed in <pre> tags assuming to get the format styles.

Add a Java step with the below code, in an activity to process the email body content, just before viewing it.


String contentType = tools.getProperty(".pyInboundEmail.ContactId").getStringValue().toLowerCase();
String inputStr= tools.getProperty(".pyInboundEmail.pyBody").getStringValue();
boolean IsPlain = false;
if(contentType.contains("ms-tnef") || contentType.contains("plain"))
{
 IsPlain = true;
}
else
{
 String ContentTypeArr[] = DistinctContentType.split(",");
 for(int i=0;i<ContentTypeArr.length;i++)
 {
  if(contentType.contains(ContentTypeArr[i]))
    {
     boolean HasHTMLAttribute= false;
     String HTMLAttributeArr[] = HTMLTags.split(",");
     for(int j=0;j<HTMLAttributeArr.length;j++)
     {
      if(inputStr.contains(HTMLAttributeArr[j]))
      {
       HasHTMLAttribute= true;
       break;
      }
     }
       if(!HasHTMLAttribute)
                   {
                     IsPlain=true;
                    }
               
    }
               
 }
}
 
if(IsPlain)
{
inputStr = inputStr.replace("<","<");
inputStr = inputStr.replace(">",">");
String formatedStr = "<pre><font size=2 face='sans-serif'>" +
inputStr + "</font></pre>";
tools.getProperty(".pyInboundEmail.pyBody").setValue(formatedStr);
}
Is valid HTML tags dynamic system setting has all possible html tags
</HTML>,</html>,</font>,</FONT>,</htm>,</HTM>,</META>,</meta>,</div>,</DIV>,</span>,</SPAN>,</br>,<br>,</BR>,<BR>

 
Suggest Edit

Published June 12, 2015 - Updated October 8, 2020

Did you find this content helpful? Yes No

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us