Read and open xml content from email

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

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?

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



msg.attachment

flow

Assuming there is only ever one XML attachement:

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

image

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) 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