# Read and open xml content from email

**URL:** <https://discourse.nodered.org/t/read-and-open-xml-content-from-email/86978>\
**Category:** General\
**Created:** [3 April 2024 17:33 UTC](https://discourse.nodered.org/t/read-and-open-xml-content-from-email/86978 "2024-04-03T17:33:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tommino1966](https://avatars.discourse-cdn.com/v4/letter/t/bc8723/32.png) [@Tommino1966](https://discourse.nodered.org/u/Tommino1966)\
**Post date:** [3 April 2024 17:33 UTC](https://discourse.nodered.org/t/read-and-open-xml-content-from-email/86978/1 "2024-04-03T17:33:49Z")

</div>

Hello. i would like to separate and open the xml file that is attached to an email.  
I would like to send myself the measured values from a cloud as an email with an attached xml attachment from an email address and query them with nodered. I would like to read the values from the xml file in the attachment

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [7 April 2024 09:05 UTC](https://discourse.nodered.org/t/read-and-open-xml-content-from-email/86978/2 "2024-04-07T09:05:14Z")

</div>

What have you tried? Where are you up to? Are you getting emails into your node-red? Have you inspected the email with debug nodes?

---

<div class="post-metadata">

**Author:** ![Tommino1966](https://avatars.discourse-cdn.com/v4/letter/t/bc8723/32.png) [@Tommino1966](https://discourse.nodered.org/u/Tommino1966)\
**Post date:** [8 April 2024 10:38 UTC](https://discourse.nodered.org/t/read-and-open-xml-content-from-email/86978/3 "2024-04-08T10:38:30Z")

</div>

Hello Steve,  
i would like to send data from an inventory management software (filling levels/consumption etc) by mail with XML (measured values) attachment to a gmail address. from there i would like to read the xml attached to the mail. so i would have an easy way to subscribe to the data from the cloud without going through an API. the subscribed data can then be made available e.g. in a gateway locally to a controller via Modbus or OPC UA

---

<div class="post-metadata">

**Author:** ![Tommino1966](https://avatars.discourse-cdn.com/v4/letter/t/bc8723/32.png) [@Tommino1966](https://discourse.nodered.org/u/Tommino1966)\
**Post date:** [8 April 2024 10:39 UTC](https://discourse.nodered.org/t/read-and-open-xml-content-from-email/86978/4 "2024-04-08T10:39:40Z")

</div>

![Email from cloud](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/d/5d4f4ed47b48e948567313ae7bbac6b774347321.jpeg)  
 ![xml-file](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/9/79471c33dc35e4321cbb7c2e05ce32181ed536ef.jpeg)  
 ![msg.attachment](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/6/16b47d1068a9324112ecc777ff7c63b5e13e694e.jpeg)

---

<div class="post-metadata">

**Author:** ![Tommino1966](https://avatars.discourse-cdn.com/v4/letter/t/bc8723/32.png) [@Tommino1966](https://discourse.nodered.org/u/Tommino1966)\
**Post date:** [8 April 2024 10:41 UTC](https://discourse.nodered.org/t/read-and-open-xml-content-from-email/86978/5 "2024-04-08T10:41:11Z")

</div>

![flow](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/7/37a78ec6923257efac88990990217e0eb3f52693.jpeg)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [8 April 2024 11:11 UTC](https://discourse.nodered.org/t/read-and-open-xml-content-from-email/86978/6 "2024-04-08T11:11:03Z")

</div>

Assuming there is only ever one XML attachement:

Pass the msg through an XML node set up like this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/0/60d4a3506a68ef045254c2076e42c6c2bf8e5d06.png)

Send it to a debug node - what do you see?

Hopefully you see the XML nicely parsed into an object where you can access any part of the data you need to.

* * *

### TIP

There’s a great page in the docs ([Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages)) that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

![BX00Cy7yHi](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd1f333a9e043b061b39917c328b0094d3e52d30.gif)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 July 2024 11:11 UTC](https://discourse.nodered.org/t/read-and-open-xml-content-from-email/86978/7 "2024-07-07T11:11:39Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
