Inbound email not being converted to plain text in description for HR case for some emails

Arka Banerjee
Kilo Guru

Hi Team,

 

ArkaBanerjee_0-1749126007978.png

As you can see in the above screenshot, the description of this forward email which creates a  new HR case in SNOW has <p> tags, which means it was not converted to plain text as expected. This is happening in rare scenarios. Could someone please help with identifying what might be causing this.

 

@Ankur Bawiskar  

10 REPLIES 10

Hi Ankur,

 

I tried with the below code to check how the output comes if its simply an html

bodyText = email.body_html;

 

The description has way more tags and html contents than just <p> as it was in the ss I attached initially. See below

 

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:PMingLiU;
panose-1:2 1 6 1 0 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Aptos;}
@font-face
{font-family:"\@PMingLiU";
panose-1:2 1 6 1 0 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:12.0pt;
font-family:"Aptos",sans-serif;
mso-ligatures:standardcontextual;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Aptos",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#467886" vlink="#96607D" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Test after code change.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Arka<o:p></o:p></span></p>
</div>
</body>
</html>

 

and if I put the strip code below it, its simply removing all of those HTML content above and beyond leaving a lot of space up and down.

 

Also that strip is removing any hyperlink if I try to add in the email body and simply copying the plain text of the hyperlink. So it seems the issue originally isnt about just the moving to the if block, as in that case a lot of other html tags and content would have been there instead of just <p>. Could you please help resolve this.

 

@Arka Banerjee 

since you said it's occurring some times

Did you check any specific pattern when it fails?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

 

Unfortunately I am unable to identify any specific pattern, and the issue is cropping up in prod where unfortunately again we dont have admin access to check the logs, and we are not able to reprduce it in QA.

@Arka Banerjee 

sorry can't help then

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Arka Banerjee 

any update to this?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader