# Multiple msg.objects when querrying email inbox

**URL:** <https://discourse.nodered.org/t/multiple-msg-objects-when-querrying-email-inbox/48990>\
**Category:** General\
**Created:** [28 July 2021 01:10 UTC](https://discourse.nodered.org/t/multiple-msg-objects-when-querrying-email-inbox/48990 "2021-07-28T01:10:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tfuchs1987](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tfuchs1987/32/44508_2.png) [@tfuchs1987](https://discourse.nodered.org/u/tfuchs1987)\
**Post date:** [28 July 2021 01:10 UTC](https://discourse.nodered.org/t/multiple-msg-objects-when-querrying-email-inbox/48990/1 "2021-07-28T01:10:30Z")

</div>

Hi Forum, I am trying to querry my email inbox and import the data from those mails. This works fine so far if I tell a function node to look for a specific msg.topic.

- node-red-node-email v1.12.3

But I am recieving a msg.object per mail in my inbox. Unfortunatly my javascripts skills are too bad to figure out how to access the first msg.object and save the information to variable1, going on to the next msg.object saving that information to variable2.

Hope someone can help me on track I guess its just the understanding of how those msg.objects can be addressed.

Thank you for your reply in advance!

---

<div class="post-metadata">

**Author:** ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)\
**Post date:** [28 July 2021 07:07 UTC](https://discourse.nodered.org/t/multiple-msg-objects-when-querrying-email-inbox/48990/2 "2021-07-28T07:07:18Z")

</div>

You probably will not need javascript for this task. You could filter the topic with a simple switch node connected to the email node and the outputs go to different paths based on the content of `msg.topic`

---

<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 July 2021 07:32 UTC](https://discourse.nodered.org/t/multiple-msg-objects-when-querrying-email-inbox/48990/3 "2021-07-28T07:32:43Z")

</div>

It isn't clear to me exactly what you want to do. What do you want to do with the emails once you have received them?

---

<div class="post-metadata">

**Author:** ![tfuchs1987](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tfuchs1987/32/44508_2.png) [@tfuchs1987](https://discourse.nodered.org/u/tfuchs1987)\
**Post date:** [28 July 2021 17:32 UTC](https://discourse.nodered.org/t/multiple-msg-objects-when-querrying-email-inbox/48990/4 "2021-07-28T17:32:08Z")

</div>

I think I have a mistake in reasoning here ... I do not need to do anything - it just ran X times if I got X messages ...

Thank you rko this node does what my javascript is doing if I already know the content of msg.topic 🙂 nice to know it would have been that easy.

---

<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:** [26 September 2021 17:32 UTC](https://discourse.nodered.org/t/multiple-msg-objects-when-querrying-email-inbox/48990/5 "2021-09-26T17:32:56Z")

</div>

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