# Html body reading

**URL:** <https://discourse.nodered.org/t/html-body-reading/11633>\
**Category:** General\
**Created:** [28 May 2019 12:24 UTC](https://discourse.nodered.org/t/html-body-reading/11633 "2019-05-28T12:24:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![DillonW](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@DillonW](https://discourse.nodered.org/u/DillonW)\
**Post date:** [28 May 2019 12:24 UTC](https://discourse.nodered.org/t/html-body-reading/11633/1 "2019-05-28T12:24:06Z")

</div>

Hi, I have a message sent to my email with a body of text(in html) format. When I view the complete message with debug it shows the following:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/571c50b599d786a83b2e5c79eeb94741f1a11b78.png)  
How can I get this in a readable form to extract the important components?

I have tried using a "html" node like follows:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/51de01e3aade923ea778198c88ce5f2350f8794e.png)  
But this doesn't return what I wish. I'd like to remove the "br"s between the text parts so I can put it into the msg.payload.

Any help is appreciated.

Dillon

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [28 May 2019 12:37 UTC](https://discourse.nodered.org/t/html-body-reading/11633/2 "2019-05-28T12:37:41Z")

</div>

The brs don't stop you putting it into the payload. If you remove them you will just have a long string with them removed. What exactly do you want to end up with?

---

<div class="post-metadata">

**Author:** ![JayDickson](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jaydickson/32/90592_2.png) [@JayDickson](https://discourse.nodered.org/u/JayDickson)\
**Post date:** [28 May 2019 12:43 UTC](https://discourse.nodered.org/t/html-body-reading/11633/3 "2019-05-28T12:43:33Z")

</div>

it looks like you're passing it through an HTML node to break it down. What is your output?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [28 May 2019 13:04 UTC](https://discourse.nodered.org/t/html-body-reading/11633/4 "2019-05-28T13:04:57Z")

</div>

in theory msg.html should contain the html version and msg.payload the plain text version - but that will depend on the sending end and it's not always the case (but worth checking). As noted you could use the html node - but you could also use the split node (which would produce a series of messages rather than one array) - or a change node to replace `<br/>` . or a function node with a small bit of code to slice it however you like.

---

<div class="post-metadata">

**Author:** ![DillonW](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@DillonW](https://discourse.nodered.org/u/DillonW)\
**Post date:** [28 May 2019 13:29 UTC](https://discourse.nodered.org/t/html-body-reading/11633/5 "2019-05-28T13:29:04Z")

</div>

Part of the email contains:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/8/8b24ee28f9bdc28aca4357954dbf015b70987327.png)  
I'd like to extract these parts of the email and have them in objects.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [28 May 2019 15:32 UTC](https://discourse.nodered.org/t/html-body-reading/11633/6 "2019-05-28T15:32:25Z")

</div>

Once we get that chunk of the email out the CSV node may be able to handle it.

---

<div class="post-metadata">

**Author:** ![DillonW](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@DillonW](https://discourse.nodered.org/u/DillonW)\
**Post date:** [30 May 2019 11:30 UTC](https://discourse.nodered.org/t/html-body-reading/11633/7 "2019-05-30T11:30:02Z")

</div>

It needed some work, but I made it work using the change and string node, by removing the unnecessary bits. If needed I can post the solution flow
