Thursday 27 April 2017

Parse text from email source in Javascript (NodeJS)

I am parsing email sources in NodeJS with Mailparser and I am able to get in JSON all fields (To, From, Body,...).

However, I would like to have the email body in plain text, and Mailparser.text returns undefined in some samples as this one:

<body lang="EN-GB" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span>LINE ONE OF THE EMAIL</span><o:p></o:p></p>
<p class="MsoNormal"><span>LINE TWO OF THE EMAIL</span><o:p></o:p></p>
</div>
</body>

How can I extract the text in such situations? Is there any NodeJS library that works in these cases?



via Arturo

No comments:

Post a Comment