Search code examples
node-red

How to specify criteria for node-red-node-email in Node-RED


I want to search for specific emails in my inbox using the node-red-node-email node in Node-RED.

The help says I should specify conditions in msg.criteria:

Uses the node-imap module - see that page for information on the msg.criteria format if needed.

The referenced doc page explains what to put there but not how to do it.

As node-red-node-email node is an originating (?) node, no payload (i.e. msg object) is passed to it. There's no way to specify a different object (e.g., a flow. variable) for the criteria either.

How can I specify msg.criteria (or more generally, how can I specify search criteria) so that node-red-node-email uses it?

Node-RED email node msg.criteria


Solution

  • Change the "Get Mail" entry at the top of the config from "automatically" to "when triggered" and the email node will gain an input port.

    You can then use this to trigger the node to check for new mail and add the msg.criteria